* Replication file for the article "Am I Eligible to Register? Registration Rules, Eligibility Uncertainty, and Youth Voter Turnout" by Alexander Held

* The author does not have permission to share data from the voter files for California, New York and Pennsylvania. Data for these states is therefore not included in the replication datasets. As a result, the code and data do not allow to reproduce results for these three states or for pooled models that include any of these three states. The article uses the statistical software Stata 14.


* Set the working directory to the folder on your computer with the datasets
* cd "C:\Users\[AUTHOR]\Documents"


****************
* APPENDIX A.2 *
****************

* The following (optional) graphic scheme requires the installation of the gr0070 package from Bischof (2017)
* Bischof, Daniel. 2017. "New Graphic Schemes for Stata: plotplain and plottig." The Stata Journal 17(3): 748-759.
* set scheme plotplain

* Figures A.1 and A.2

use "data.dta", clear
gen birth_date=birthdate
format birth_date %td
gen dow=dow(birth_date)
gen voted08_adj=voted08
replace voted08_adj=. if dow==0 | dow==6

replace days_08 = days_08 - 28 if state=="AR"
replace days_08 = days_08 - 28 if state=="CO"
replace days_08 = days_08 - 28 if state=="FL"
replace days_08 = days_08 - 27 if state=="IL"
replace days_08 = days_08 - 28 if state=="KY"
replace days_08 = days_08 - 26 if state=="MO"
replace days_08 = days_08 - 28 if state=="MT"
replace days_08 = days_08 - 28 if state=="OH"
replace days_08 = days_08 - 28 if state=="PA"
replace days_08 = days_08 - 28 if state=="TX"
replace days_08 = days_08 - 29 if state=="RI"
replace days_08 = days_08 - 13 if state=="CT"
replace days_08 = days_08 - 9 if state=="IA"
replace days_08 = days_08 - 14 if state=="CA"
replace days_08 = days_08 - 20 if state=="NJ"
replace days_08 = days_08 - 20 if state=="NV"
replace days_08 = days_08 - 20 if state=="OR"
replace days_08 = days_08 - 24 if state=="NY"
replace days_08 = days_08 - 24 if state=="OK"

drop days_12
drop days_06
drop days_10
drop days_14
drop days_16
drop days_18
gen days_06 = days_08 + 727   // 10539
gen days_10 = days_08 - 729   // 11994
gen days_12 = days_08 - 1463  // 12728
gen days_14 = days_08 - 2192  // 13457 - nov 4, 1996
gen days_16 = days_08 - 2926  // 14191 - nov 8, 1998
gen days_18 = days_08 - 3655  //       - nov 6, 2000

replace days_12 = days_12 + 1 if state=="AR"
replace days_12 = days_12 + 1 if state=="CO"
replace days_12 = days_12 + 1 if state=="FL"
replace days_12 = days_12 + 1 if state=="KY"
replace days_12 = days_12 + 1 if state=="MT"
replace days_12 = days_12 + 1 if state=="OH"
replace days_12 = days_12 + 1 if state=="PA"
replace days_12 = days_12 + 1 if state=="TX"

twoway (scatter voted08_adj days_08, sort msize(small) msymbol(circle_hollow) mcolor(black)) (lpolyci voted08_adj days_08 if days_08>-180 & days_08<=-28, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) (lpolyci voted08_adj days_08 if days_08>-28 & days_08<0, lp(solid) lcolor(black) bw(5) ciplot(rline) alpattern(shortdash)) (lpoly voted08_adj days_08 if days_08>0 & days_08<180, lcolor(black)) ///
if state=="OH" & days_08>-180 & days_08<180, ytitle(Votes, size(huge)) ylabel(, angle(horizontal) nogrid labsize(huge)) xtitle(Date of Birth, size(huge)) xline(-28, lc(gs12)) xline(0, lc(gs6)) xtitle(, margin(top)) xlabel(-153 "6/4/90" 0 "11/4/90" 151 "4/4/91", nogrid labsize(huge) valuelabel)  title("OH", bexpand justification(left) size(vhuge)) legend(off)
graph save "g13.gph", replace
twoway (scatter voted08_adj days_08, sort msize(small) msymbol(circle_hollow) mcolor(black)) (lpolyci voted08_adj days_08 if days_08>-180 & days_08<=-28, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) (lpolyci voted08_adj days_08 if days_08>-28 & days_08<0, lp(solid) lcolor(black) bw(5) ciplot(rline) alpattern(shortdash)) (lpoly voted08_adj days_08 if days_08>0 & days_08<180, lcolor(black)) ///
if state=="TX" & days_08>-180 & days_08<180, ytitle(Votes, size(huge)) ylabel(, angle(horizontal) nogrid labsize(huge)) xtitle(Date of Birth, size(huge)) xline(-28, lc(gs12)) xline(0, lc(gs6)) xtitle(, margin(top)) xlabel(-153 "6/4/90" 0 "11/4/90" 151 "4/4/91", nogrid labsize(huge) valuelabel)  title("TX", bexpand justification(left) size(vhuge)) legend(off)
graph save "g18.gph", replace
*twoway (scatter voted08_adj days_08, sort msize(small) msymbol(circle_hollow) mcolor(black)) (lpolyci voted08_adj days_08 if days_08>-180 & days_08<=-15, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) (lpolyci voted08_adj days_08 if days_08>-15 & days_08<0, lp(solid) lcolor(black) bw(5) ciplot(rline) alpattern(shortdash)) (lpoly voted08_adj days_08 if days_08>0 & days_08<180, lcolor(black)) ///
*if state=="CA" & days_08>-180 & days_08<180, ytitle(Votes, size(huge)) ylabel(, angle(horizontal) nogrid labsize(huge)) xtitle(Date of Birth, size(huge)) xline(-15, lc(gs12)) xline(0, lc(gs6)) xtitle(, margin(top)) xlabel(-153 "6/4/90" 0 "11/4/90" 151 "4/4/91", nogrid labsize(huge) valuelabel)  title("CA", bexpand justification(left) size(vhuge)) legend(off)
*graph save "g1.gph", replace
twoway (scatter voted08_adj days_08, sort msize(small) msymbol(circle_hollow) mcolor(black)) (lpolyci voted08_adj days_08 if days_08>-180 & days_08<=-28, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) (lpolyci voted08_adj days_08 if days_08>-28 & days_08<0, lp(solid) lcolor(black) bw(5) ciplot(rline) alpattern(shortdash)) (lpoly voted08_adj days_08 if days_08>0 & days_08<180, lcolor(black)) ///
if state=="AR" & days_08>-180 & days_08<180, ytitle(Votes, size(huge)) ylabel(, angle(horizontal) nogrid labsize(huge)) xtitle(Date of Birth, size(huge)) xline(-28, lc(gs12)) xline(0, lc(gs6)) xtitle(, margin(top)) xlabel(-153 "6/4/90" 0 "11/4/90" 151 "4/4/91", nogrid labsize(huge) valuelabel)  title("AK", bexpand justification(left) size(vhuge)) legend(off)
graph save "g0.gph", replace
twoway (scatter voted08_adj days_08, sort msize(small) msymbol(circle_hollow) mcolor(black)) (lpolyci voted08_adj days_08 if days_08>-180 & days_08<=-28, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) (lpolyci voted08_adj days_08 if days_08>-28 & days_08<0, lp(solid) lcolor(black) bw(5) ciplot(rline) alpattern(shortdash)) (lpoly voted08_adj days_08 if days_08>0 & days_08<180, lcolor(black)) ///
if state=="CO" & days_08>-180 & days_08<180, ytitle(Votes, size(huge)) ylabel(, angle(horizontal) nogrid labsize(huge)) xtitle(Date of Birth, size(huge)) xline(-28, lc(gs12)) xline(0, lc(gs6)) xtitle(, margin(top)) xlabel(-153 "6/4/90" 0 "11/4/90" 151 "4/4/91", nogrid labsize(huge) valuelabel)  title("CO", bexpand justification(left) size(vhuge)) legend(off)
graph save "g2.gph", replace
twoway (scatter voted08_adj days_08, sort msize(small) msymbol(circle_hollow) mcolor(black)) (lpolyci voted08_adj days_08 if days_08>-180 & days_08<=-14, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) (lpolyci voted08_adj days_08 if days_08>-14 & days_08<0, lp(solid) lcolor(black) bw(5) ciplot(rline) alpattern(shortdash)) (lpoly voted08_adj days_08 if days_08>0 & days_08<180, lcolor(black)) ///
if state=="CT" & days_08>-180 & days_08<180, ytitle(Votes, size(huge)) ylabel(, angle(horizontal) nogrid labsize(huge)) xtitle(Date of Birth, size(huge)) xline(-14, lc(gs12)) xline(0, lc(gs6)) xtitle(, margin(top)) xlabel(-153 "6/4/90" 0 "11/4/90" 151 "4/4/91", nogrid labsize(huge) valuelabel)  title("CT", bexpand justification(left) size(vhuge)) legend(off)
graph save "g3.gph", replace
twoway (scatter voted08_adj days_08, sort msize(small) msymbol(circle_hollow) mcolor(black)) (lpolyci voted08_adj days_08 if days_08>-180 & days_08<=-28, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) (lpolyci voted08_adj days_08 if days_08>-28 & days_08<0, lp(solid) lcolor(black) bw(5) ciplot(rline) alpattern(shortdash)) (lpoly voted08_adj days_08 if days_08>0 & days_08<180, lcolor(black)) ///
if state=="FL" & days_08>-180 & days_08<180, ytitle(Votes, size(huge)) ylabel(, angle(horizontal) nogrid labsize(huge)) xtitle(Date of Birth, size(huge)) xline(-28, lc(gs12)) xline(0, lc(gs6)) xtitle(, margin(top)) xlabel(-153 "6/4/90" 0 "11/4/90" 151 "4/4/91", nogrid labsize(huge) valuelabel)  title("FL", bexpand justification(left) size(vhuge)) legend(off)
graph save "g4.gph", replace
twoway (scatter voted08_adj days_08, sort msize(small) msymbol(circle_hollow) mcolor(black)) (lpolyci voted08_adj days_08 if days_08>-180 & days_08<=-15, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) (lpolyci voted08_adj days_08 if days_08>-15 & days_08<0, lp(solid) lcolor(black) bw(5) ciplot(rline) alpattern(shortdash)) (lpoly voted08_adj days_08 if days_08>0 & days_08<180, lcolor(black)) ///
if state=="IA" & days_08>-180 & days_08<180, ytitle(Votes, size(huge)) ylabel(, angle(horizontal) nogrid labsize(huge)) xtitle(Date of Birth, size(huge)) xline(-15, lc(gs12)) xline(0, lc(gs6)) xtitle(, margin(top)) xlabel(-153 "6/4/90" 0 "11/4/90" 151 "4/4/91", nogrid labsize(huge) valuelabel)  title("IA", bexpand justification(left) size(vhuge)) legend(off)
graph save "g5.gph", replace
twoway (scatter voted08_adj days_08, sort msize(small) msymbol(circle_hollow) mcolor(black)) (lpolyci voted08_adj days_08 if days_08>-180 & days_08<=-28, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) (lpolyci voted08_adj days_08 if days_08>-28 & days_08<0, lp(solid) lcolor(black) bw(5) ciplot(rline) alpattern(shortdash)) (lpoly voted08_adj days_08 if days_08>0 & days_08<180, lcolor(black)) ///
if state=="IL" & days_08>-180 & days_08<180, ytitle(Votes, size(huge)) ylabel(, angle(horizontal) nogrid labsize(huge)) xtitle(Date of Birth, size(huge)) xline(-28, lc(gs12)) xline(0, lc(gs6)) xtitle(, margin(top)) xlabel(-153 "6/4/90" 0 "11/4/90" 151 "4/4/91", nogrid labsize(huge) valuelabel)  title("IL", bexpand justification(left) size(vhuge)) legend(off)
graph save "g6.gph", replace
twoway (scatter voted08_adj days_08, sort msize(small) msymbol(circle_hollow) mcolor(black)) (lpolyci voted08_adj days_08 if days_08>-180 & days_08<=-28, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) (lpolyci voted08_adj days_08 if days_08>-28 & days_08<0, lp(solid) lcolor(black) bw(5) ciplot(rline) alpattern(shortdash)) (lpoly voted08_adj days_08 if days_08>0 & days_08<180, lcolor(black)) ///
if state=="KY" & days_08>-180 & days_08<180, ytitle(Votes, size(huge)) ylabel(, angle(horizontal) nogrid labsize(huge)) xtitle(Date of Birth, size(huge)) xline(-28, lc(gs12)) xline(0, lc(gs6)) xtitle(, margin(top)) xlabel(-153 "6/4/90" 0 "11/4/90" 151 "4/4/91", nogrid labsize(huge) valuelabel)  title("KY", bexpand justification(left) size(vhuge)) legend(off)
graph save "g7.gph", replace
twoway (scatter voted08_adj days_08, sort msize(small) msymbol(circle_hollow) mcolor(black)) (lpolyci voted08_adj days_08 if days_08>-180 & days_08<=-28, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) (lpolyci voted08_adj days_08 if days_08>-28 & days_08<0, lp(solid) lcolor(black) bw(5) ciplot(rline) alpattern(shortdash)) (lpoly voted08_adj days_08 if days_08>0 & days_08<180, lcolor(black)) ///
if state=="MO" & days_08>-180 & days_08<180, ytitle(Votes, size(huge)) ylabel(, angle(horizontal) nogrid labsize(huge)) xtitle(Date of Birth, size(huge)) xline(-28, lc(gs12)) xline(0, lc(gs6)) xtitle(, margin(top)) xlabel(-153 "6/4/90" 0 "11/4/90" 151 "4/4/91", nogrid labsize(huge) valuelabel)  title("MO", bexpand justification(left) size(vhuge)) legend(off)
graph save "g8.gph", replace
twoway (scatter voted08_adj days_08, sort msize(small) msymbol(circle_hollow) mcolor(black)) (lpolyci voted08_adj days_08 if days_08>-180 & days_08<=-28, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) (lpolyci voted08_adj days_08 if days_08>-28 & days_08<0, lp(solid) lcolor(black) bw(5) ciplot(rline) alpattern(shortdash)) (lpoly voted08_adj days_08 if days_08>0 & days_08<180, lcolor(black)) ///
if state=="MT" & days_08>-180 & days_08<180, ytitle(Votes, size(huge)) ylabel(, angle(horizontal) nogrid labsize(huge)) xtitle(Date of Birth, size(huge)) xline(-28, lc(gs12)) xline(0, lc(gs6)) xtitle(, margin(top)) xlabel(-153 "6/4/90" 0 "11/4/90" 151 "4/4/91", nogrid labsize(huge) valuelabel)  title("MT", bexpand justification(left) size(vhuge)) legend(off)
graph save "g9.gph", replace
twoway (scatter voted08_adj days_08, sort msize(small) msymbol(circle_hollow) mcolor(black)) (lpolyci voted08_adj days_08 if days_08>-180 & days_08<=-21, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) (lpolyci voted08_adj days_08 if days_08>-21 & days_08<0, lp(solid) lcolor(black) bw(5) ciplot(rline) alpattern(shortdash)) (lpoly voted08_adj days_08 if days_08>0 & days_08<180, lcolor(black)) ///
if state=="NJ" & days_08>-180 & days_08<180, ytitle(Votes, size(huge)) ylabel(, angle(horizontal) nogrid labsize(huge)) xtitle(Date of Birth, size(huge)) xline(-21, lc(gs12)) xline(0, lc(gs6)) xtitle(, margin(top)) xlabel(-153 "6/4/90" 0 "11/4/90" 151 "4/4/91", nogrid labsize(huge) valuelabel)  title("NJ", bexpand justification(left) size(vhuge)) legend(off)
graph save "g10.gph", replace
twoway (scatter voted08_adj days_08, sort msize(small) msymbol(circle_hollow) mcolor(black)) (lpolyci voted08_adj days_08 if days_08>-180 & days_08<=-21, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) (lpolyci voted08_adj days_08 if days_08>-21 & days_08<0, lp(solid) lcolor(black) bw(5) ciplot(rline) alpattern(shortdash)) (lpoly voted08_adj days_08 if days_08>0 & days_08<180, lcolor(black)) ///
if state=="NV" & days_08>-180 & days_08<180, ytitle(Votes, size(huge)) ylabel(, angle(horizontal) nogrid labsize(huge)) xtitle(Date of Birth, size(huge)) xline(-21, lc(gs12)) xline(0, lc(gs6)) xtitle(, margin(top)) xlabel(-153 "6/4/90" 0 "11/4/90" 151 "4/4/91", nogrid labsize(huge) valuelabel)  title("NV", bexpand justification(left) size(vhuge)) legend(off)
graph save "g11.gph", replace
*twoway (scatter voted08_adj days_08, sort msize(small) msymbol(circle_hollow) mcolor(black)) (lpolyci voted08_adj days_08 if days_08>-180 & days_08<=-25, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) (lpolyci voted08_adj days_08 if days_08>-25 & days_08<0, lp(solid) lcolor(black) bw(5) ciplot(rline) alpattern(shortdash)) (lpoly voted08_adj days_08 if days_08>0 & days_08<180, lcolor(black)) ///
*if state=="NY" & days_08>-180 & days_08<180, ytitle(Votes, size(huge)) ylabel(, angle(horizontal) nogrid labsize(huge)) xtitle(Date of Birth, size(huge)) xline(-25, lc(gs12)) xline(0, lc(gs6)) xtitle(, margin(top)) xlabel(-153 "6/4/90" 0 "11/4/90" 151 "4/4/91", nogrid labsize(huge) valuelabel)  title("NY", bexpand justification(left) size(vhuge)) legend(off)
*graph save "g12.gph", replace
twoway (scatter voted08_adj days_08, sort msize(small) msymbol(circle_hollow) mcolor(black)) (lpolyci voted08_adj days_08 if days_08>-180 & days_08<=-25, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) (lpolyci voted08_adj days_08 if days_08>-25 & days_08<0, lp(solid) lcolor(black) bw(5) ciplot(rline) alpattern(shortdash)) (lpoly voted08_adj days_08 if days_08>0 & days_08<180, lcolor(black)) ///
if state=="OK" & days_08>-180 & days_08<180, ytitle(Votes, size(huge)) ylabel(, angle(horizontal) nogrid labsize(huge)) xtitle(Date of Birth, size(huge)) xline(-25, lc(gs12)) xline(0, lc(gs6)) xtitle(, margin(top)) xlabel(-153 "6/4/90" 0 "11/4/90" 151 "4/4/91", nogrid labsize(huge) valuelabel)  title("OK", bexpand justification(left) size(vhuge)) legend(off)
graph save "g14.gph", replace
twoway (scatter voted08_adj days_08, sort msize(small) msymbol(circle_hollow) mcolor(black)) (lpolyci voted08_adj days_08 if days_08>-180 & days_08<=-21, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) (lpolyci voted08_adj days_08 if days_08>-21 & days_08<0, lp(solid) lcolor(black) bw(5) ciplot(rline) alpattern(shortdash)) (lpoly voted08_adj days_08 if days_08>0 & days_08<180, lcolor(black)) ///
if state=="OR" & days_08>-180 & days_08<180, ytitle(Votes, size(huge)) ylabel(, angle(horizontal) nogrid labsize(huge)) xtitle(Date of Birth, size(huge)) xline(-21, lc(gs12)) xline(0, lc(gs6)) xtitle(, margin(top)) xlabel(-153 "6/4/90" 0 "11/4/90" 151 "4/4/91", nogrid labsize(huge) valuelabel)  title("OR", bexpand justification(left) size(vhuge)) legend(off)
graph save "g15.gph", replace
*twoway (scatter voted08_adj days_08, sort msize(small) msymbol(circle_hollow) mcolor(black)) (lpolyci voted08_adj days_08 if days_08>-180 & days_08<=-28, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) (lpolyci voted08_adj days_08 if days_08>-28 & days_08<0, lp(solid) lcolor(black) bw(5) ciplot(rline) alpattern(shortdash)) (lpoly voted08_adj days_08 if days_08>0 & days_08<180, lcolor(black)) ///
*if state=="PA" & days_08>-180 & days_08<180, ytitle(Votes, size(huge)) ylabel(, angle(horizontal) nogrid labsize(huge)) xtitle(Date of Birth, size(huge)) xline(-28, lc(gs12)) xline(0, lc(gs6)) xtitle(, margin(top)) xlabel(-153 "6/4/90" 0 "11/4/90" 151 "4/4/91", nogrid labsize(huge) valuelabel)  title("PA", bexpand justification(left) size(vhuge)) legend(off)
*graph save "g16.gph", replace
twoway (scatter voted08_adj days_08, sort msize(small) msymbol(circle_hollow) mcolor(black)) (lpolyci voted08_adj days_08 if days_08>-180 & days_08<=-30, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) (lpolyci voted08_adj days_08 if days_08>-30 & days_08<0, lp(solid) lcolor(black) bw(5) ciplot(rline) alpattern(shortdash)) (lpoly voted08_adj days_08 if days_08>0 & days_08<180, lcolor(black)) ///
if state=="RI" & days_08>-180 & days_08<180, ytitle(Votes, size(huge)) ylabel(, angle(horizontal) nogrid labsize(huge)) xtitle(Date of Birth, size(huge)) xline(-30, lc(gs12)) xline(0, lc(gs6)) xtitle(, margin(top)) xlabel(-153 "6/4/90" 0 "11/4/90" 151 "4/4/91", nogrid labsize(huge) valuelabel)  title("RI", bexpand justification(left) size(vhuge)) legend(off)
graph save "g17.gph", replace

graph combine g0.gph g2.gph g4.gph g6.gph g7.gph g8.gph g13.gph g14.gph g17.gph g18.gph, ysize(2) altshrink
graph export "FigureGen1.pdf", as(pdf) replace
graph export "FigureGen1.eps", as(eps) replace

graph combine g3.gph g5.gph g9.gph g10.gph g11.gph g15.gph, ysize(2) altshrink
graph export "FigureGen2.pdf", as(pdf) replace
graph export "FigureGen2.eps", as(eps) replace




****************
* APPENDIX A.5 *
****************

use "data.dta", clear

sort state
by state: egen t06 = mean(voted06) if days_06>=-10 & days_06<=-1
by state: egen treatment06 = max(t06)
by state: egen t08 = mean(voted08) if days_08>=-10 & days_08<=-1
by state: egen treatment08 = max(t08)
by state: egen t10 = mean(voted10) if days_10>=-10 & days_10<=-1
by state: egen treatment10 = max(t10)
by state: egen t12 = mean(voted12) if days_12>=-10 & days_12<=-1
by state: egen treatment12 = max(t12)
by state: egen t14 = mean(voted14) if days_14>=-10 & days_14<=-1
by state: egen treatment14 = max(t14)
by state: egen t16 = mean(voted16) if days_16>=-10 & days_16<=-1
by state: egen treatment16 = max(t16)
by state: egen t18 = mean(voted18) if days_18>=-10 & days_18<=-1
by state: egen treatment18 = max(t18)
drop t06 t08 t10 t12 t14 t16 t18

gen regdl = 0
replace regdl = 1 if days_06 >= 0

sort state birthdate
replace voted06lag = voted06lag/treatment06
replace voted08lag = voted08lag/treatment08
replace voted10lag = voted10lag/treatment10
replace voted12lag = voted12lag/treatment12
replace voted14lag = voted14lag/treatment14
replace voted16lag = voted16lag/treatment16
replace voted18lag = voted18lag/treatment18

replace voted06 = voted06/treatment06*100
replace voted08 = voted08/treatment08*100
replace voted10 = voted10/treatment10*100
replace voted12 = voted12/treatment12*100
replace voted14 = voted14/treatment14*100
replace voted16 = voted16/treatment16*100
replace voted18 = voted18/treatment18*100

gen tar = regdl if state=="AR"
gen tco = regdl if state=="CO"
gen tfl = regdl if state=="FL"
gen til = regdl if state=="IL"
gen tky = regdl if state=="KY"
gen tmo = regdl if state=="MO"
gen tmt = regdl if state=="MT"
gen toh = regdl if state=="OH"
gen tpa = regdl if state=="PA"
gen ttx = regdl if state=="TX"
gen tri = regdl if state=="RI"
gen tct = regdl if state=="CT"
gen tia = regdl if state=="IA"
gen tca = regdl if state=="CA"
gen tnj = regdl if state=="NJ"
gen tnv = regdl if state=="NV"
gen tor = regdl if state=="OR"
gen tny = regdl if state=="NY"
gen tok = regdl if state=="OK"

recode tar tco tfl til tky tmo tmt toh tpa ttx tri tct tia tca tnj ///
	tnv tor tny tok (. = 0)

regress voted06 tar voted06lag if (days_06>=-10 & days_06<=9) & state=="AR", robust
estimates store AR
regress voted06 tco voted06lag if (days_06>=-10 & days_06<=9) & state=="CO", robust
estimates store CO
regress voted06 tfl voted06lag if (days_06>=-10 & days_06<=9) & state=="FL", robust
estimates store FL
regress voted06 til voted06lag if (days_06>=-10 & days_06<=9) & state=="IL", robust
estimates store IL
regress voted06 tmo voted06lag if (days_06>=-10 & days_06<=9) & state=="MO", robust
estimates store MO
regress voted06 tmt voted06lag if (days_06>=-10 & days_06<=9) & state=="MT", robust
estimates store MT
regress voted06 toh voted06lag if (days_06>=-10 & days_06<=9) & state=="OH", robust
estimates store OH
*regress voted06 tpa voted06lag if (days_06>=-10 & days_06<=9) & state=="PA", robust
*estimates store PA
regress voted06 tct voted06lag if (days_06>=-10 & days_06<=9) & state=="CT", robust
estimates store CT
regress voted06 tia voted06lag if (days_06>=-10 & days_06<=9) & state=="IA", robust
estimates store IA
*regress voted06 tca voted06lag if (days_06>=-10 & days_06<=9) & state=="CA", robust
*estimates store CA
regress voted06 tnj voted06lag if (days_06>=-10 & days_06<=9) & state=="NJ", robust
estimates store NJ
regress voted06 tnv voted06lag if (days_06>=-10 & days_06<=9) & state=="NV", robust
estimates store NV
regress voted06 tor voted06lag if (days_06>=-10 & days_06<=9) & state=="OR", robust
estimates store OR
*regress voted06 tny voted06lag if (days_06>=-10 & days_06<=9) & state=="NY", robust
*estimates store NY
regress voted06 tok voted06lag if (days_06>=-10 & days_06<=9) & state=="OK", robust
estimates store OK

coefplot (AR \ CT \ FL \ IL \ IA \ MO \ MT \ NV \ NJ \ OH \ OK \ OR), ///
	keep(tar tfl til tky tmo tmt toh tpa ttx tri tct tia tca tnj ///
	tnv tor tny tok) xline(0) coeflabels(tar="AR" tfl="FL" til="IL" tky="KY" /// 
	tmo="MO" tmt="MT" toh="OH" tpa="PA" ttx="TX" tri="RI" tct="CT" tia="IA" tca="CA" tnj="NJ" /// 
	tnv="NV" tor="OR" tny="NY" tok="OK") xtitle("Estimate Decrease in %", size(medium))  ///
	xscale(range(-60 40))  xlabel(-60 "-60" -40 "-40" -20 "-20" 0 "0"  ///
	20 "20" 40 "40", angle(horizontal)) xtick(-60(20)40) ///
	title("2006 Midterm Elections", size(vlarge)) grid(none)
graph save "FigureA5a.gph", replace

drop regdl
gen regdl = 0
replace regdl = 1 if days_10 >= 0
replace tar = regdl if state=="AR"
replace tco = regdl if state=="CO"
replace tfl = regdl if state=="FL"
replace til = regdl if state=="IL"
replace tky = regdl if state=="KY"
replace tmo = regdl if state=="MO"
replace tmt = regdl if state=="MT"
replace toh = regdl if state=="OH"
replace tpa = regdl if state=="PA"
replace ttx = regdl if state=="TX"
replace tri = regdl if state=="RI"
replace tct = regdl if state=="CT"
replace tia = regdl if state=="IA"
replace tca = regdl if state=="CA"
replace tnj = regdl if state=="NJ"
replace tnv = regdl if state=="NV"
replace tor = regdl if state=="OR"
replace tny = regdl if state=="NY"
replace tok = regdl if state=="OK"
recode tar tco tfl til tky tmo tmt toh tpa ttx tri tct tia tca tnj ///
	tnv tor tny tok (. = 0)

estimates clear

regress voted10 tar voted10lag if (days_10>=-10 & days_10<=9) & state=="AR", robust
estimates store AR
regress voted10 tfl voted10lag if (days_10>=-10 & days_10<=9) & state=="FL", robust
estimates store FL
regress voted10 til voted10lag if (days_10>=-10 & days_10<=9) & state=="IL", robust
estimates store IL
regress voted10 tky voted10lag if (days_10>=-10 & days_10<=9) & state=="KY", robust
estimates store KY
regress voted10 tmo voted10lag if (days_10>=-10 & days_10<=9) & state=="MO", robust
estimates store MO
regress voted10 tmt voted10lag if (days_10>=-10 & days_10<=9) & state=="MT", robust
estimates store MT
regress voted10 toh voted10lag if (days_10>=-10 & days_10<=9) & state=="OH", robust
estimates store OH
*regress voted10 tpa voted10lag if (days_10>=-10 & days_10<=9) & state=="PA", robust
*estimates store PA
regress voted10 ttx voted10lag if (days_10>=-10 & days_10<=9) & state=="TX", robust
estimates store TX
regress voted10 tri voted10lag if (days_10>=-10 & days_10<=9) & state=="RI", robust
estimates store RI
regress voted10 tct voted10lag if (days_10>=-10 & days_10<=9) & state=="CT", robust
estimates store CT
regress voted10 tia voted10lag if (days_10>=-10 & days_10<=9) & state=="IA", robust
estimates store IA
*regress voted10 tca voted10lag if (days_10>=-10 & days_10<=9) & state=="CA", robust
*estimates store CA
regress voted10 tnj voted10lag if (days_10>=-10 & days_10<=9) & state=="NJ", robust
estimates store NJ
regress voted10 tnv voted10lag if (days_10>=-10 & days_10<=9) & state=="NV", robust
estimates store NV
regress voted10 tor voted10lag if (days_10>=-10 & days_10<=9) & state=="OR", robust
estimates store OR
*regress voted10 tny voted10lag if (days_10>=-10 & days_10<=9) & state=="NY", robust
*estimates store NY
regress voted10 tok voted10lag if (days_10>=-10 & days_10<=9) & state=="OK", robust
estimates store OK

coefplot (AR \ CT \ FL \ IL \ IA \ KY \ MO \ MT \ NV \ NJ \ OH \ OK \ OR \ RI \ TX), ///
	keep(tar tfl til tky tmo tmt toh tpa ttx tri tct tia tca tnj ///
	tnv tor tny tok) xline(0) coeflabels(tar="AR" tfl="FL" til="IL" tky="KY" /// 
	tmo="MO" tmt="MT" toh="OH" tpa="PA" ttx="TX" tri="RI" tct="CT" tia="IA" tca="CA" tnj="NJ" /// 
	tnv="NV" tor="OR" tny="NY" tok="OK") xtitle("Estimate Decrease in %", size(medium))  ///
	xscale(range(-60 40))  xlabel(-60 "-60" -40 "-40" -20 "-20" 0 "0"  ///
	20 "20" 40 "40", angle(horizontal)) xtick(-60(20)40) ///
	title("2010 Midterm Elections", size(vlarge)) grid(none)
graph save "FigureA5b.gph", replace

drop regdl
gen regdl = 0
replace regdl = 1 if days_14 >= 0
replace tar = regdl if state=="AR"
replace tco = regdl if state=="CO"
replace tfl = regdl if state=="FL"
replace til = regdl if state=="IL"
replace tky = regdl if state=="KY"
replace tmo = regdl if state=="MO"
replace tmt = regdl if state=="MT"
replace toh = regdl if state=="OH"
replace tpa = regdl if state=="PA"
replace ttx = regdl if state=="TX"
replace tri = regdl if state=="RI"
replace tct = regdl if state=="CT"
replace tia = regdl if state=="IA"
replace tca = regdl if state=="CA"
replace tnj = regdl if state=="NJ"
replace tnv = regdl if state=="NV"
replace tor = regdl if state=="OR"
replace tny = regdl if state=="NY"
replace tok = regdl if state=="OK"
recode tar tco tfl til tky tmo tmt toh tpa ttx tri tct tia tca tnj ///
	tnv tor tny tok (. = 0)

estimates clear

regress voted14 tfl voted14lag if (days_14>=-10 & days_14<=9) & state=="FL", robust
estimates store FL
regress voted14 toh voted14lag if (days_14>=-10 & days_14<=9) & state=="OH", robust
estimates store OH
*regress voted14 tpa voted14lag if (days_14>=-10 & days_14<=9) & state=="PA", robust
*estimates store PA
regress voted14 ttx voted14lag if (days_14>=-10 & days_14<=9) & state=="TX", robust
estimates store TX
*regress voted14 tca voted14lag if (days_14>=-10 & days_14<=9) & state=="CA", robust
*estimates store CA
*regress voted14 tny voted14lag if (days_14>=-10 & days_14<=9) & state=="NY", robust
*estimates store NY
regress voted14 tok voted14lag if (days_14>=-10 & days_14<=9) & state=="OK", robust
estimates store OK

coefplot (FL \ OH \ OK \ TX), ///
	keep(tfl toh tpa ttx tca  ///
	tny tok) xline(0) coeflabels(tfl="FL"  /// 
	tmo="MO" tmt="MT" toh="OH" tpa="PA" ttx="TX" tca="CA" /// 
	tny="NY" tok="OK") xtitle("Estimate Decrease in %", size(medium))  ///
	xscale(range(-60 40))  xlabel(-60 "-60" -40 "-40" -20 "-20" 0 "0"  ///
	20 "20" 40 "40", angle(horizontal)) xtick(-60(20)40) ///
	title("2014 Midterm Elections", size(vlarge)) grid(none)
graph save "FigureA5c.gph", replace

drop regdl
gen regdl = 0
replace regdl = 1 if days_18 >= 0
replace tar = regdl if state=="AR"
replace tco = regdl if state=="CO"
replace tfl = regdl if state=="FL"
replace til = regdl if state=="IL"
replace tky = regdl if state=="KY"
replace tmo = regdl if state=="MO"
replace tmt = regdl if state=="MT"
replace toh = regdl if state=="OH"
replace tpa = regdl if state=="PA"
replace ttx = regdl if state=="TX"
replace tri = regdl if state=="RI"
replace tct = regdl if state=="CT"
replace tia = regdl if state=="IA"
replace tca = regdl if state=="CA"
replace tnj = regdl if state=="NJ"
replace tnv = regdl if state=="NV"
replace tor = regdl if state=="OR"
replace tny = regdl if state=="NY"
replace tok = regdl if state=="OK"
recode tar tco tfl til tky tmo tmt toh tpa ttx tri tct tia tca tnj ///
	tnv tor tny tok (. = 0)

estimates clear

regress voted18 tfl voted18lag if (days_18>=-10 & days_18<=9) & state=="FL", robust
estimates store FL
regress voted18 toh voted18lag if (days_18>=-10 & days_18<=9) & state=="OH", robust
estimates store OH
*regress voted18 tpa voted18lag if (days_18>=-10 & days_18<=9) & state=="PA", robust
*estimates store PA
*regress voted18 tca voted18lag if (days_18>=-10 & days_18<=9) & state=="CA", robust
*estimates store CA
*regress voted18 tny voted18lag if (days_18>=-10 & days_18<=9) & state=="NY", robust
*estimates store NY
regress voted18 tok voted18lag if (days_18>=-10 & days_18<=9) & state=="OK", robust
estimates store OK

coefplot (FL \ OH \ OK), ///
	keep(tfl toh tpa ttx tca tny tok) xline(0) coeflabels(tfl="FL" /// 
	toh="OH" tpa="PA" ttx="TX" tca="CA" /// 
	tny="NY" tok="OK") xtitle("Estimate Decrease in %", size(medium))  ///
	xscale(range(-80 40))  xlabel(-60 "-60" -40 "-40" -20 "-20" 0 "0"  ///
	20 "20" 40 "40", angle(horizontal)) xtick(-60(20)40) ///
	title("2018 Midterm Elections", size(vlarge)) grid(none)
graph save "FigureA5d.gph", replace

graph combine FigureA5a.gph FigureA5b.gph FigureA5c.gph FigureA5d.gph, altshrink
graph export "Figure4cong.pdf", as(pdf) replace
graph export "Figure4cong.eps", as(eps) replace









****************
* APPENDIX A.6 *
****************

use "data.dta", clear

sort state
by state: egen t06 = mean(voted06) if days_06>=-10 & days_06<=-1
by state: egen treatment06 = max(t06)
by state: egen t08 = mean(voted08) if days_08>=-10 & days_08<=-1
by state: egen treatment08 = max(t08)
by state: egen t10 = mean(voted10) if days_10>=-10 & days_10<=-1
by state: egen treatment10 = max(t10)
by state: egen t12 = mean(voted12) if days_12>=-10 & days_12<=-1
by state: egen treatment12 = max(t12)
by state: egen t14 = mean(voted14) if days_14>=-10 & days_14<=-1
by state: egen treatment14 = max(t14)
by state: egen t16 = mean(voted16) if days_16>=-10 & days_16<=-1
by state: egen treatment16 = max(t16)
by state: egen t18 = mean(voted18) if days_18>=-10 & days_18<=-1
by state: egen treatment18 = max(t18)
drop t06 t08 t10 t12 t14 t16 t18

gen regdl = 0
replace regdl = 1 if days_08 >= 0

sort state birthdate
replace voted06lag = voted06lag/treatment06
replace voted08lag = voted08lag/treatment08
replace voted10lag = voted10lag/treatment10
replace voted12lag = voted12lag/treatment12
replace voted14lag = voted14lag/treatment14
replace voted16lag = voted16lag/treatment16
replace voted18lag = voted18lag/treatment18

replace voted06 = voted06/treatment06*100
replace voted08 = voted08/treatment08*100
replace voted10 = voted10/treatment10*100
replace voted12 = voted12/treatment12*100
replace voted14 = voted14/treatment14*100
replace voted16 = voted16/treatment16*100
replace voted18 = voted18/treatment18*100

gen tar = regdl if state=="AR"
gen tco = regdl if state=="CO"
gen tfl = regdl if state=="FL"
gen til = regdl if state=="IL"
gen tky = regdl if state=="KY"
gen tmo = regdl if state=="MO"
gen tmt = regdl if state=="MT"
gen toh = regdl if state=="OH"
gen tpa = regdl if state=="PA"
gen ttx = regdl if state=="TX"
gen tri = regdl if state=="RI"
gen tct = regdl if state=="CT"
gen tia = regdl if state=="IA"
gen tca = regdl if state=="CA"
gen tnj = regdl if state=="NJ"
gen tnv = regdl if state=="NV"
gen tor = regdl if state=="OR"
gen tny = regdl if state=="NY"
gen tok = regdl if state=="OK"

recode tar tco tfl til tky tmo tmt toh tpa ttx tri tct tia tca tnj ///
	tnv tor tny tok (. = 0)

regress voted08 tar voted08lag if (days_08>=-10 & days_08<=9) & state=="AR", robust
regress voted08 tco voted08lag if (days_08>=-10 & days_08<=9) & state=="CO", robust
regress voted08 tfl voted08lag if (days_08>=-10 & days_08<=9) & state=="FL", robust
regress voted08 til voted08lag if (days_08>=-10 & days_08<=9) & state=="IL", robust
regress voted08 tky voted08lag if (days_08>=-10 & days_08<=9) & state=="KY", robust
regress voted08 tmo voted08lag if (days_08>=-10 & days_08<=9) & state=="MO", robust
regress voted08 tmt voted08lag if (days_08>=-10 & days_08<=9) & state=="MT", robust
regress voted08 toh voted08lag if (days_08>=-10 & days_08<=9) & state=="OH", robust
*regress voted08 tpa voted08lag if (days_08>=-10 & days_08<=9) & state=="PA", robust
regress voted08 ttx voted08lag if (days_08>=-10 & days_08<=9) & state=="TX", robust
regress voted08 tri voted08lag if (days_08>=-10 & days_08<=9) & state=="RI", robust
regress voted08 tct voted08lag if (days_08>=-10 & days_08<=9) & state=="CT", robust
regress voted08 tia voted08lag if (days_08>=-10 & days_08<=9) & state=="IA", robust
*regress voted08 tca voted08lag if (days_08>=-10 & days_08<=9) & state=="CA", robust
regress voted08 tnj voted08lag if (days_08>=-10 & days_08<=9) & state=="NJ", robust
regress voted08 tnv voted08lag if (days_08>=-10 & days_08<=9) & state=="NV", robust
regress voted08 tor voted08lag if (days_08>=-10 & days_08<=9) & state=="OR", robust
*regress voted08 tny voted08lag if (days_08>=-10 & days_08<=9) & state=="NY", robust
regress voted08 tok voted08lag if (days_08>=-10 & days_08<=9) & state=="OK", robust

*regress voted08 regdl voted08lag if (days_08>=-10 & days_08<=9) & (state=="AR" | state=="CO" | state=="FL" | state=="IL" | state=="KY" | state=="MO" | state=="NY" | state=="OH" | state=="OK" | state=="PA" | state=="RI" | state=="TX"), vce(cluster state)

*regress voted08 regdl voted08lag if (days_08>=-10 & days_08<=9) & (state=="CA" | state=="CT" | state=="IA" | state=="MT" | state=="NV" | state=="NJ" | state=="OR"), vce(cluster state)

drop regdl
gen regdl = 0
replace regdl = 1 if days_12 >= 0
replace tar = regdl if state=="AR"
replace tco = regdl if state=="CO"
replace tfl = regdl if state=="FL"
replace til = regdl if state=="IL"
replace tky = regdl if state=="KY"
replace tmo = regdl if state=="MO"
replace tmt = regdl if state=="MT"
replace toh = regdl if state=="OH"
replace tpa = regdl if state=="PA"
replace ttx = regdl if state=="TX"
replace tri = regdl if state=="RI"
replace tct = regdl if state=="CT"
replace tia = regdl if state=="IA"
replace tca = regdl if state=="CA"
replace tnj = regdl if state=="NJ"
replace tnv = regdl if state=="NV"
replace tor = regdl if state=="OR"
replace tny = regdl if state=="NY"
replace tok = regdl if state=="OK"
recode tar tco tfl til tky tmo tmt toh tpa ttx tri tct tia tca tnj ///
	tnv tor tny tok (. = 0)

regress voted12 tar voted12lag if (days_12>=-10 & days_12<=9) & state=="AR", robust
regress voted12 tfl voted12lag if (days_12>=-10 & days_12<=9) & state=="FL", robust
regress voted12 til voted12lag if (days_12>=-10 & days_12<=9) & state=="IL", robust
regress voted12 tky voted12lag if (days_12>=-10 & days_12<=9) & state=="KY", robust
regress voted12 tmo voted12lag if (days_12>=-10 & days_12<=9) & state=="MO", robust
regress voted12 tmt voted12lag if (days_12>=-10 & days_12<=9) & state=="MT", robust
regress voted12 toh voted12lag if (days_12>=-10 & days_12<=9) & state=="OH", robust
*regress voted12 tpa voted12lag if (days_12>=-10 & days_12<=9) & state=="PA", robust
regress voted12 ttx voted12lag if (days_12>=-10 & days_12<=9) & state=="TX", robust
regress voted12 tri voted12lag if (days_12>=-10 & days_12<=9) & state=="RI", robust
regress voted12 tct voted12lag if (days_12>=-10 & days_12<=9) & state=="CT", robust
regress voted12 tia voted12lag if (days_12>=-10 & days_12<=9) & state=="IA", robust
*regress voted12 tca voted12lag if (days_12>=-10 & days_12<=9) & state=="CA", robust
regress voted12 tnj voted12lag if (days_12>=-10 & days_12<=9) & state=="NJ", robust
regress voted12 tnv voted12lag if (days_12>=-10 & days_12<=9) & state=="NV", robust
regress voted12 tor voted12lag if (days_12>=-10 & days_12<=9) & state=="OR", robust
*regress voted12 tny voted12lag if (days_12>=-10 & days_12<=9) & state=="NY", robust
regress voted12 tok voted12lag if (days_12>=-10 & days_12<=9) & state=="OK", robust

*regress voted12 regdl voted12lag if (days_12>=-10 & days_12<=9) & (state=="AR" | state=="FL" | state=="IL" | state=="KY" | state=="MO" | state=="NY" | state=="OH" | state=="OK" | state=="PA" | state=="RI" | state=="TX"), vce(cluster state)

*regress voted12 regdl voted12lag if (days_12>=-10 & days_12<=9) & (state=="CA" | state=="CT" | state=="IA" | state=="MT" | state=="NV" | state=="NJ" | state=="OR"), vce(cluster state)


drop regdl
gen regdl = 0
replace regdl = 1 if days_16 >= 0
replace tar = regdl if state=="AR"
replace tco = regdl if state=="CO"
replace tfl = regdl if state=="FL"
replace til = regdl if state=="IL"
replace tky = regdl if state=="KY"
replace tmo = regdl if state=="MO"
replace tmt = regdl if state=="MT"
replace toh = regdl if state=="OH"
replace tpa = regdl if state=="PA"
replace ttx = regdl if state=="TX"
replace tri = regdl if state=="RI"
replace tct = regdl if state=="CT"
replace tia = regdl if state=="IA"
replace tca = regdl if state=="CA"
replace tnj = regdl if state=="NJ"
replace tnv = regdl if state=="NV"
replace tor = regdl if state=="OR"
replace tny = regdl if state=="NY"
replace tok = regdl if state=="OK"
recode tar tco tfl til tky tmo tmt toh tpa ttx tri tct tia tca tnj ///
	tnv tor tny tok (. = 0)

regress voted16 tfl voted16lag if (days_16>=-10 & days_16<=9) & state=="FL", robust
regress voted16 toh voted16lag if (days_16>=-10 & days_16<=9) & state=="OH", robust
*regress voted16 tpa voted16lag if (days_16>=-10 & days_16<=9) & state=="PA", robust
* Texas without lagged DV and more narrow 7-day window due to missing data
regress voted16 ttx if (days_16>=-7 & days_16<=6) & state=="TX", robust
*regress voted16 tca voted16lag if (days_16>=-10 & days_16<=9) & state=="CA", robust
*regress voted16 tny voted16lag if (days_16>=-10 & days_16<=9) & state=="NY", robust
regress voted16 tok voted16lag if (days_16>=-10 & days_16<=9) & state=="OK", robust

*regress voted16 regdl if (days_16>=-7 & days_16<=6) & (state=="FL" | state=="NY" | state=="OH" | state=="OK" | state=="PA" | state=="TX"), vce(cluster state)

* The following model does not include Texas due to missing data (no lagged DV)
gen regdl1b = regdl
*regress voted16 regdl1b voted16lag if (days_16>=-10 & days_16<=9) & (state=="FL" | state=="NY" | state=="OH" | state=="OK" | state=="PA"), vce(cluster state)




****************
* APPENDIX A.7 *
****************

use "data.dta", clear
gen birth_date=birthdate
format birth_date %td
gen dow=dow(birth_date)
gen voted08_adj=voted08
replace voted08_adj=. if dow==0 | dow==6

replace days_08 = days_08 - 28 if state=="AR"
replace days_08 = days_08 - 28 if state=="CO"
replace days_08 = days_08 - 28 if state=="FL"
replace days_08 = days_08 - 27 if state=="IL"
replace days_08 = days_08 - 28 if state=="KY"
replace days_08 = days_08 - 26 if state=="MO"
replace days_08 = days_08 - 28 if state=="MT"
replace days_08 = days_08 - 28 if state=="OH"
replace days_08 = days_08 - 28 if state=="PA"
replace days_08 = days_08 - 28 if state=="TX"
replace days_08 = days_08 - 29 if state=="RI"
replace days_08 = days_08 - 13 if state=="CT"
replace days_08 = days_08 - 9 if state=="IA"
replace days_08 = days_08 - 14 if state=="CA"
replace days_08 = days_08 - 20 if state=="NJ"
replace days_08 = days_08 - 20 if state=="NV"
replace days_08 = days_08 - 20 if state=="OR"
replace days_08 = days_08 - 24 if state=="NY"
replace days_08 = days_08 - 24 if state=="OK"

drop days_12
drop days_06
drop days_10
drop days_14
drop days_16
drop days_18
gen days_06 = days_08 + 727   // 10539
gen days_10 = days_08 - 729   // 11994
gen days_12 = days_08 - 1463  // 12728
gen days_14 = days_08 - 2192  // 13457 - nov 4, 1996
gen days_16 = days_08 - 2926  // 14191 - nov 8, 1998
gen days_18 = days_08 - 3655  //       - nov 6, 2000

replace days_12 = days_12 + 1 if state=="AR"
replace days_12 = days_12 + 1 if state=="CO"
replace days_12 = days_12 + 1 if state=="FL"
replace days_12 = days_12 + 1 if state=="KY"
replace days_12 = days_12 + 1 if state=="MT"
replace days_12 = days_12 + 1 if state=="OH"
replace days_12 = days_12 + 1 if state=="PA"
replace days_12 = days_12 + 1 if state=="TX"

gen voted12_adj=voted12
replace voted12_adj=. if dow==0 | dow==6
gen voted16_adj=voted16
replace voted16_adj=. if dow==0 | dow==6

*twoway (scatter voted08_adj days_08, sort msize(small) msymbol(circle_hollow) mcolor(black)) (lpolyci voted08_adj days_08 if days_08>-180 & days_08<=-15, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) (lpolyci voted08_adj days_08 if days_08>-15 & days_08<0, lp(solid) lcolor(black) bw(5) ciplot(rline) alpattern(shortdash)) (lpoly voted08_adj days_08 if days_08>0 & days_08<180, lcolor(black)) ///
*if state=="CA" & days_08>-180 & days_08<180, ytitle(Votes, size(large)) ylabel(, angle(horizontal) nogrid labsize(large)) xtitle(Date of Birth, size(large)) xline(-15, lc(gs12)) xline(0, lc(gs6)) xtitle(, margin(top)) xlabel(-153 "6/4/90" 0 "11/4/90" 151 "4/4/91", nogrid labsize(large) valuelabel)  title("2008", bexpand size(huge)) legend(off)
*graph save "g1_08.gph", replace
*twoway (scatter voted12_adj days_12, sort msize(small) msymbol(circle_hollow) mcolor(black)) (lpolyci voted12_adj days_12 if days_12>-180 & days_12<=-15, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) (lpolyci voted12_adj days_12 if days_12>-15 & days_12<0, lp(solid) lcolor(black) bw(5) ciplot(rline) alpattern(shortdash)) (lpoly voted12_adj days_12 if days_12>0 & days_12<180, lcolor(black)) ///
*if state=="CA" & days_12>-180 & days_12<180, ytitle(Votes, size(large)) ylabel(, angle(horizontal) nogrid labsize(large)) xtitle(Date of Birth, size(large)) xline(-15, lc(gs12)) xline(0, lc(gs6)) xtitle(, margin(top)) xlabel(-153 "6/6/94" 0 "11/6/94" 151 "4/6/95", nogrid labsize(large) valuelabel)  title("2012", bexpand size(huge)) legend(off)
*graph save "g1_12.gph", replace
*twoway (scatter voted16_adj days_16, sort msize(small) msymbol(circle_hollow) mcolor(black)) (lpolyci voted16_adj days_16 if days_16>-180 & days_16<=-15, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) (lpolyci voted16_adj days_16 if days_16>-15 & days_16<0, lp(solid) lcolor(black) bw(5) ciplot(rline) alpattern(shortdash)) (lpoly voted16_adj days_16 if days_16>0 & days_16<180, lcolor(black)) ///
*if state=="CA" & days_16>-180 & days_16<180, ytitle(Votes, size(large)) ylabel(, angle(horizontal) nogrid labsize(large)) xtitle(Date of Birth, size(large)) xline(-15, lc(gs12)) xline(0, lc(gs6)) xtitle(, margin(top)) xlabel(-153 "6/8/98" 0 "11/8/98" 151 "4/8/99", nogrid labsize(large) valuelabel)  title("2016", bexpand size(huge)) legend(off)
*graph save "g1_16.gph", replace
twoway (scatter voted08_adj days_08, sort msize(small) msymbol(circle_hollow) mcolor(black)) (lpolyci voted08_adj days_08 if days_08>-180 & days_08<=-28, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) (lpolyci voted08_adj days_08 if days_08>-28 & days_08<0, lp(solid) lcolor(black) bw(5) ciplot(rline) alpattern(shortdash)) (lpoly voted08_adj days_08 if days_08>0 & days_08<180, lcolor(black)) ///
if state=="FL" & days_08>-180 & days_08<180, ytitle(Votes, size(huge)) ylabel(, angle(horizontal) nogrid labsize(huge)) xtitle(Date of Birth, size(huge)) xline(-28, lc(gs12)) xline(0, lc(gs6)) xtitle(, margin(top)) xlabel(-153 "6/4/90" 0 "11/4/90" 151 "4/4/91", nogrid labsize(huge) valuelabel)  title("FL 2008", bexpand size(vhuge)) legend(off)
graph save "g4_08.gph", replace
twoway (scatter voted12_adj days_12, sort msize(small) msymbol(circle_hollow) mcolor(black)) (lpolyci voted12_adj days_12 if days_12>-180 & days_12<=-28, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) (lpolyci voted12_adj days_12 if days_12>-28 & days_12<0, lp(solid) lcolor(black) bw(5) ciplot(rline) alpattern(shortdash)) (lpoly voted12_adj days_12 if days_12>0 & days_12<180, lcolor(black)) ///
if state=="FL" & days_12>-180 & days_12<180, ytitle(Votes, size(huge)) ylabel(, angle(horizontal) nogrid labsize(huge)) xtitle(Date of Birth, size(huge)) xline(-28, lc(gs12)) xline(0, lc(gs6)) xtitle(, margin(top)) xlabel(-153 "6/6/94" 0 "11/6/94" 151 "4/6/95", nogrid labsize(huge) valuelabel)  title("FL 2012", bexpand size(vhuge)) legend(off)
graph save "g4_12.gph", replace
twoway (scatter voted16_adj days_16, sort msize(small) msymbol(circle_hollow) mcolor(black)) (lpolyci voted16_adj days_16 if days_16>-180 & days_16<=-28, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) (lpolyci voted16_adj days_16 if days_16>-28 & days_16<0, lp(solid) lcolor(black) bw(5) ciplot(rline) alpattern(shortdash)) (lpoly voted16_adj days_16 if days_16>0 & days_16<180, lcolor(black)) ///
if state=="FL" & days_16>-180 & days_16<180, ytitle(Votes, size(huge)) ylabel(, angle(horizontal) nogrid labsize(huge)) xtitle(Date of Birth, size(huge)) xline(-28, lc(gs12)) xline(0, lc(gs6)) xtitle(, margin(top)) xlabel(-153 "6/8/98" 0 "11/8/98" 151 "4/8/99", nogrid labsize(huge) valuelabel)  title("FL 2016", bexpand size(vhuge)) legend(off)
graph save "g4_16.gph", replace
*twoway (scatter voted08_adj days_08, sort msize(small) msymbol(circle_hollow) mcolor(black)) (lpolyci voted08_adj days_08 if days_08>-180 & days_08<=-28, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) (lpolyci voted08_adj days_08 if days_08>-28 & days_08<0, lp(solid) lcolor(black) bw(5) ciplot(rline) alpattern(shortdash)) (lpoly voted08_adj days_08 if days_08>0 & days_08<180, lcolor(black)) ///
*if state=="PA" & days_08>-180 & days_08<180, ytitle(Votes, size(huge)) ylabel(, angle(horizontal) nogrid labsize(huge)) xtitle(Date of Birth, size(huge)) xline(-28, lc(gs12)) xline(0, lc(gs6)) xtitle(, margin(top)) xlabel(-153 "6/4/90" 0 "11/4/90" 151 "4/4/91", nogrid labsize(huge) valuelabel)  title("PA 2008", bexpand size(vhuge)) legend(off)
*graph save "g16_08.gph", replace
*twoway (scatter voted12_adj days_12, sort msize(small) msymbol(circle_hollow) mcolor(black)) (lpolyci voted12_adj days_12 if days_12>-180 & days_12<=-28, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) (lpolyci voted12_adj days_12 if days_12>-28 & days_12<0, lp(solid) lcolor(black) bw(5) ciplot(rline) alpattern(shortdash)) (lpoly voted12_adj days_12 if days_12>0 & days_12<180, lcolor(black)) ///
*if state=="PA" & days_12>-180 & days_12<180, ytitle(Votes, size(huge)) ylabel(, angle(horizontal) nogrid labsize(huge)) xtitle(Date of Birth, size(huge)) xline(-28, lc(gs12)) xline(0, lc(gs6)) xtitle(, margin(top)) xlabel(-153 "6/6/94" 0 "11/6/94" 151 "4/6/95", nogrid labsize(huge) valuelabel)  title("PA 2012", bexpand size(vhuge)) legend(off)
*graph save "g16_12.gph", replace
*twoway (scatter voted16_adj days_16, sort msize(small) msymbol(circle_hollow) mcolor(black)) (lpolyci voted16_adj days_16 if days_16>-180 & days_16<=-28, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) (lpolyci voted16_adj days_16 if days_16>-28 & days_16<0, lp(solid) lcolor(black) bw(5) ciplot(rline) alpattern(shortdash)) (lpoly voted16_adj days_16 if days_16>0 & days_16<180, lcolor(black)) ///
*if state=="PA" & days_16>-180 & days_16<180, ytitle(Votes, size(huge)) ylabel(, angle(horizontal) nogrid labsize(huge)) xtitle(Date of Birth, size(huge)) xline(-28, lc(gs12)) xline(0, lc(gs6)) xtitle(, margin(top)) xlabel(-153 "6/8/98" 0 "11/8/98" 151 "4/8/99", nogrid labsize(huge) valuelabel)  title("PA 2016", bexpand size(vhuge)) legend(off)
*graph save "g16_16.gph", replace
twoway (scatter voted08_adj days_08, sort msize(small) msymbol(circle_hollow) mcolor(black)) (lpolyci voted08_adj days_08 if days_08>-180 & days_08<=-28, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) (lpolyci voted08_adj days_08 if days_08>-28 & days_08<0, lp(solid) lcolor(black) bw(5) ciplot(rline) alpattern(shortdash)) (lpoly voted08_adj days_08 if days_08>0 & days_08<180, lcolor(black)) ///
if state=="IL" & days_08>-180 & days_08<180, ytitle(Votes, size(huge)) ylabel(, angle(horizontal) nogrid labsize(huge)) xtitle(Date of Birth, size(huge)) xline(-28, lc(gs12)) xline(0, lc(gs6)) xtitle(, margin(top)) xlabel(-153 "6/4/90" 0 "11/4/90" 151 "4/4/91", nogrid labsize(huge) valuelabel)  title("IL 2008", bexpand size(vhuge)) legend(off)
graph save "g6_08.gph", replace
twoway (scatter voted12_adj days_12, sort msize(small) msymbol(circle_hollow) mcolor(black)) (lpolyci voted12_adj days_12 if days_12>-180 & days_12<=-28, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) (lpolyci voted12_adj days_12 if days_12>-28 & days_12<0, lp(solid) lcolor(black) bw(5) ciplot(rline) alpattern(shortdash)) (lpoly voted12_adj days_12 if days_12>0 & days_12<180, lcolor(black)) ///
if state=="IL" & days_12>-180 & days_12<180, ytitle(Votes, size(huge)) ylabel(, angle(horizontal) nogrid labsize(huge)) xtitle(Date of Birth, size(huge)) xline(-28, lc(gs12)) xline(0, lc(gs6)) xtitle(, margin(top)) xlabel(-153 "6/6/94" 0 "11/6/94" 151 "4/6/95", nogrid labsize(huge) valuelabel)  title("IL 2012", bexpand size(vhuge)) legend(off)
graph save "g6_12.gph", replace
replace rv08=-rv08

graph combine g4_08.gph g6_08.gph g4_12.gph g6_12.gph g4_16.gph, ysize(2) altshrink
graph export "FigureGenCh.pdf", as(pdf) replace
graph export "FigureGenCh.eps", as(eps) replace




****************
* APPENDIX A.8 *
****************

* Figure A.7
use "data.dta", clear

sort state
by state: egen t08 = mean(voted08) if days_08>=-10 & days_08<=-1
by state: egen treatment08 = max(t08)
by state: egen t12 = mean(voted12) if days_12>=-10 & days_12<=-1
by state: egen treatment12 = max(t12)
drop t08 t12

gen regdl = 0
replace regdl = 1 if days_08 >= 0

sort state birthdate
replace voted08lag = voted08lag/treatment08
replace voted12lag = voted12lag/treatment12
replace voted08 = voted08/treatment08*100
replace voted12 = voted12/treatment12*100
replace voted08=voted08/100
gen regdays=.
replace regdays=29 if state=="AR"
replace regdays=15 if state=="CA"
replace regdays=29 if state=="CO"
replace regdays=14 if state=="CT"
replace regdays=29 if state=="FL"
replace regdays=10 if state=="IA"
replace regdays=28 if state=="IL"
replace regdays=29 if state=="KY"
replace regdays=27 if state=="MO"
replace regdays=29 if state=="MT"
replace regdays=21 if state=="NJ"
replace regdays=21 if state=="NV"
replace regdays=25 if state=="NY"
replace regdays=29 if state=="OH"
replace regdays=25 if state=="OK"
replace regdays=21 if state=="OR"
replace regdays=29 if state=="PA"
replace regdays=30 if state=="RI"
replace regdays=29 if state=="TX"
gen regdlXregdays=regdl*regdays

* Note that results in the article are different from the following regressions because they include data for CA, NY and PA.

* Column 1
regress voted08 regdl regdays regdlXregdays voted08lag if (days_08>=-10 & days_08<=9), vce(cluster state)

drop regdlXregdays
replace regdays=0 if state=="IA"
replace regdays=0 if state=="MT"
gen regdlXregdays=regdl*regdays
* Column 3
regress voted08 regdl regdays regdlXregdays voted08lag if (days_08>=-10 & days_08<=9), vce(cluster state)
* Column 5
regress voted08 regdl regdays regdlXregdays voted08lag if state!="IA" & state!="MT" & (days_08>=-10 & days_08<=9), vce(cluster state)

replace voted08=voted08*100
drop regdl regdays regdlXregdays
gen regdl = 0
replace regdl = 1 if days_12 >= 0
replace voted12=voted12/100
gen regdays=.
replace regdays=28 if state=="AR"
replace regdays=15 if state=="CA"
replace regdays=28 if state=="CO"
replace regdays=14 if state=="CT"
replace regdays=28 if state=="FL"
replace regdays=10 if state=="IA"
replace regdays=28 if state=="IL"
replace regdays=28 if state=="KY"
replace regdays=27 if state=="MO"
replace regdays=28 if state=="MT"
replace regdays=21 if state=="NJ"
replace regdays=21 if state=="NV"
replace regdays=25 if state=="NY"
replace regdays=28 if state=="OH"
replace regdays=25 if state=="OK"
replace regdays=21 if state=="OR"
replace regdays=28 if state=="PA"
replace regdays=30 if state=="RI"
replace regdays=28 if state=="TX"
gen regdlXregdays=regdl*regdays

* Column 2
regress voted12 regdl regdays regdlXregdays voted12lag if (days_12>=-10 & days_12<=9), vce(cluster state)

drop regdlXregdays
replace regdays=0 if state=="IA"
replace regdays=0 if state=="MT"
gen regdlXregdays=regdl*regdays
* Column 4
regress voted12 regdl regdays regdlXregdays voted12lag if (days_12>=-10 & days_12<=9), vce(cluster state)
* Column 6
regress voted12 regdl regdays regdlXregdays voted12lag if state!="IA" & state!="MT" & (days_12>=-10 & days_12<=9), vce(cluster state)
replace voted12=voted12*100



* Figure A.8
use "data.dta", clear

sort state
by state: egen t08 = mean(voted08) if days_08>=-10 & days_08<=-1
by state: egen treatment08 = max(t08)
by state: egen t12 = mean(voted12) if days_12>=-10 & days_12<=-1
by state: egen treatment12 = max(t12)
drop t08 t12

gen regdl = 0
replace regdl = 1 if days_08 >= 0

sort state birthdate
replace voted08lag = voted08lag/treatment08
replace voted12lag = voted12lag/treatment12
replace voted08 = voted08/treatment08*100
replace voted12 = voted12/treatment12*100
replace voted08=voted08/100
gen sdr=0
replace sdr=1 if state=="IA" | state=="MT"
gen regdlXsdr=regdl*sdr
gen regdays=.
replace regdays=29 if state=="AR"
replace regdays=15 if state=="CA"
replace regdays=29 if state=="CO"
replace regdays=14 if state=="CT"
replace regdays=29 if state=="FL"
replace regdays=10 if state=="IA"
replace regdays=28 if state=="IL"
replace regdays=29 if state=="KY"
replace regdays=27 if state=="MO"
replace regdays=29 if state=="MT"
replace regdays=21 if state=="NJ"
replace regdays=21 if state=="NV"
replace regdays=25 if state=="NY"
replace regdays=29 if state=="OH"
replace regdays=25 if state=="OK"
replace regdays=21 if state=="OR"
replace regdays=29 if state=="PA"
replace regdays=30 if state=="RI"
replace regdays=29 if state=="TX"
gen regdlXregdays=regdl*regdays
gen misinf=0
replace misinf=1 if state=="FL" | state=="OK" | state=="TX"
gen regdlXmisinf=regdl*misinf

* Note that results in the article are different from the following regressions because they include data for CA, NY and PA.

* Column 1
regress voted08 regdl sdr regdlXsdr voted08lag if (days_08>=-10 & days_08<=9), robust
* Column 3
regress voted08 regdl regdays regdlXregdays voted08lag if (days_08>=-10 & days_08<=9), robust
* Column 5
regress voted08 regdl misinf regdlXmisinf voted08lag if (days_08>=-10 & days_08<=9), robust
* Column 7
regress voted08 regdl sdr regdlXsdr regdays regdlXregdays misinf regdlXmisinf voted08lag if (days_08>=-10 & days_08<=9), robust

replace voted08=voted08*100
drop regdl regdays regdlXregdays regdlXsdr regdlXmisinf
gen regdl = 0
replace regdl = 1 if days_12 >= 0
replace voted12=voted12/100
gen regdlXsdr=regdl*sdr
gen regdays=.
replace regdays=28 if state=="AR"
replace regdays=15 if state=="CA"
replace regdays=28 if state=="CO"
replace regdays=14 if state=="CT"
replace regdays=28 if state=="FL"
replace regdays=10 if state=="IA"
replace regdays=28 if state=="IL"
replace regdays=28 if state=="KY"
replace regdays=27 if state=="MO"
replace regdays=28 if state=="MT"
replace regdays=21 if state=="NJ"
replace regdays=21 if state=="NV"
replace regdays=25 if state=="NY"
replace regdays=28 if state=="OH"
replace regdays=25 if state=="OK"
replace regdays=21 if state=="OR"
replace regdays=28 if state=="PA"
replace regdays=30 if state=="RI"
replace regdays=28 if state=="TX"
gen regdlXregdays=regdl*regdays
gen regdlXmisinf=regdl*misinf

* Column 2
regress voted12 regdl sdr regdlXsdr voted12lag if (days_12>=-10 & days_12<=9), robust
* Column 4
regress voted12 regdl regdays regdlXregdays voted12lag if (days_12>=-10 & days_12<=9), robust
* Column 6
regress voted12 regdl misinf regdlXmisinf voted12lag if (days_12>=-10 & days_12<=9), robust
* Column 8
regress voted12 regdl sdr regdlXsdr regdays regdlXregdays misinf regdlXmisinf voted12lag if (days_12>=-10 & days_12<=9), robust
replace voted12=voted12*100




*****************
* APPENDIX A.10 *
*****************

use "data.dta", clear

encode state, gen(state2)
tab state2, gen(sdum)

gen regdl = 0
replace regdl = 1 if days_08 >= 0

gen var = voted08 * sdum1
gen vco = voted08 * sdum2
gen vfl = voted08 * sdum4
gen vil = voted08 * sdum6
gen vky = voted08 * sdum7
gen vmo = voted08 * sdum8
gen vmt = voted08 * sdum9
gen voh = voted08 * sdum12
gen vtx = voted08 * sdum16
gen vri = voted08 * sdum15
gen vct = voted08 * sdum3
gen via = voted08 * sdum5
gen vnj = voted08 * sdum10
gen vnv = voted08 * sdum11
gen vor = voted08 * sdum14
gen vok = voted08 * sdum13

ivregress 2sls voted12 (var = regdl) voted12lag if  state=="AR" & (days_08>=-10 & days_08<=9), robust first
ivregress 2sls voted12 (vfl = regdl) voted12lag if  state=="FL" & (days_08>=-10 & days_08<=9), robust first
ivregress 2sls voted12 (vil = regdl) voted12lag if  state=="IL" & (days_08>=-10 & days_08<=9), robust first
ivregress 2sls voted12 (vmo = regdl) voted12lag if  state=="MO" & (days_08>=-10 & days_08<=9), robust first
*ivregress 2sls voted12 (vpa = regdl) voted12lag if  state=="PA" & (days_08>=-10 & days_08<=9), robust first
ivregress 2sls voted12 (vtx = regdl) voted12lag if  state=="TX" & (days_08>=-10 & days_08<=9), robust first
ivregress 2sls voted12 (vri = regdl) voted12lag if  state=="RI" & (days_08>=-10 & days_08<=9), robust first
ivregress 2sls voted12 (vok = regdl) voted12lag if  state=="OK" & (days_08>=-10 & days_08<=9), robust first

*ivregress 2sls voted12 (voted08 = regdl) voted12lag if  (state=="AR" | state=="FL" | state=="IL" | state=="MO" | state=="OK" | state=="PA" | state=="TX" | state=="RI") & (days_08>=-10 & days_08<=9), vce(cluster state) first


ivregress 2sls voted16 (vfl = regdl) voted16lag if  state=="FL" & (days_08>=-10 & days_08<=9), robust first
*ivregress 2sls voted16 (vpa = regdl) voted16lag if  state=="PA" & (days_08>=-10 & days_08<=9), robust first
ivregress 2sls voted16 (vtx = regdl) if  state=="TX" & (days_08>=-7 & days_08<=6), robust first
ivregress 2sls voted16 (vok = regdl) voted16lag if  state=="OK" & (days_08>=-10 & days_08<=9), robust first

gen voted08p2a = voted08
gen voted08p2b = voted08
gen voted08p2c = voted08
ivregress 2sls voted16 (voted08p2a = regdl) if  (state=="FL" | state=="OK" | state=="PA" | state=="TX") & (days_08>=-7 & days_08<=6), vce(cluster state) first
ivregress 2sls voted16 (voted08p2b = regdl) voted16lag if  (state=="FL" | state=="OK" | state=="PA") & (days_08>=-10 & days_08<=9), vce(cluster state) first
ivregress 2sls voted16 (voted08p2c = regdl) if  (state=="FL" | state=="OK" | state=="TX") & (days_08>=-7 & days_08<=6), vce(cluster state) first


ivregress 2sls voted10 (var = regdl) voted10lag if  state=="AR" & (days_08>=-10 & days_08<=9), robust first
ivregress 2sls voted10 (vfl = regdl) voted10lag if  state=="FL" & (days_08>=-10 & days_08<=9), robust first
ivregress 2sls voted10 (vil = regdl) voted10lag if  state=="IL" & (days_08>=-10 & days_08<=9), robust first
ivregress 2sls voted10 (vmo = regdl) voted10lag if  state=="MO" & (days_08>=-10 & days_08<=9), robust first
*ivregress 2sls voted10 (vpa = regdl) voted10lag if  state=="PA" & (days_08>=-10 & days_08<=9), robust first
ivregress 2sls voted10 (vtx = regdl) voted10lag if  state=="TX" & (days_08>=-10 & days_08<=9), robust first
ivregress 2sls voted10 (vri = regdl) voted10lag if  state=="RI" & (days_08>=-10 & days_08<=9), robust first
ivregress 2sls voted10 (vok = regdl) voted10lag if  state=="OK" & (days_08>=-10 & days_08<=9), robust first

*ivregress 2sls voted10 (voted08 = regdl) voted10lag if  (state=="AR" | state=="FL" | state=="IL" | state=="MO" | state=="OK" | state=="PA" | state=="TX" | state=="RI") & (days_08>=-10 & days_08<=9), vce(cluster state) first


ivregress 2sls voted14 (vfl = regdl) voted14lag if  state=="FL" & (days_08>=-10 & days_08<=9), robust first
*ivregress 2sls voted14 (vpa = regdl) voted14lag if  state=="PA" & (days_08>=-10 & days_08<=9), robust first
ivregress 2sls voted14 (vtx = regdl) voted14lag if  state=="TX" & (days_08>=-10 & days_08<=9), robust first
ivregress 2sls voted14 (vok = regdl) voted14lag if  state=="OK" & (days_08>=-10 & days_08<=9), robust first

*ivregress 2sls voted14 (voted08 = regdl) voted14lag if  (state=="FL" | state=="OK" | state=="PA" | state=="TX") & (days_08>=-10 & days_08<=9), vce(cluster state) first


* Base rate of voting

* Florida
display (.4973372 - (.5241367*.6476565) - ((1-(.4553556-.5241367)-.5241367)*.30661))/(.4553556-.5241367)
display (.6014431 - (.5241367*.6122583) - ((1-(.4553556-.5241367)-.5241367)*.5490838))/(.4553556-.5241367)
display (.1441333 - (.5241367*.2379548) - ((1-(.4553556-.5241367)-.5241367)*.0467932))/(.4553556-.5241367)
display (.2295138 - (.5241367*.300885) - ((1-(.4553556-.5241367)-.5241367)*.1436518))/(.4553556-.5241367)

* Pennsylvania
display (.3130504 - (.3446757*.587108) - ((1-(.3109003-.3446757)-.3446757)*.1626641))/(.3109003-.3446757)
display (.4495597 - (.3446757*.5969803) - ((1-(.3109003-.3446757)-.3446757)*.3541467))/(.3109003-.3446757)
display (.1078863 - (.3446757*.2595819) - ((1-(.3109003-.3446757)-.3446757)*.0288184))/(.3109003-.3446757)
display (.1092874 - (.3446757*.2154472) - ((1-(.3109003-.3446757)-.3446757)*.0544348))/(.3109003-.3446757)

* Texas
display (.2677123 - (.3396287*.44235) - ((1-(.261132-.3396287)-.3396287)*.1860358))/(.261132-.3396287)
display (.3613957 - (.3396287*.3820295) - ((1-(.261132-.3396287)-.3396287)*.3392417))/(.261132-.3396287)
display (.086321 - (.3396287*.1831605) - ((1-(.261132-.3396287)-.3396287)*.0423859))/(.261132-.3396287)
display (.0911225 - (.3396287*.1539428) - ((1-(.261132-.3396287)-.3396287)*.0605734))/(.261132-.3396287)




*****************
* APPENDIX A.11 *
*****************

use "data.dta", clear

encode state, gen(state2)
tab state2, gen(sdum)

gen regdl = 0
replace regdl = 1 if days_06 >= 0

gen var = voted06 * sdum1
gen vco = voted06 * sdum2
gen vfl = voted06 * sdum4
gen vil = voted06 * sdum6
gen vky = voted06 * sdum7
gen vmo = voted06 * sdum8
gen vmt = voted06 * sdum9
gen voh = voted06 * sdum12
gen vtx = voted06 * sdum16
gen vri = voted06 * sdum15
gen vct = voted06 * sdum3
gen via = voted06 * sdum5
gen vnj = voted06 * sdum10
gen vnv = voted06 * sdum11
gen vor = voted06 * sdum14
gen vok = voted06 * sdum13

ivregress 2sls voted10 (var = regdl) voted10lag if  state=="AR" & (days_06>=-10 & days_06<=9), robust first
estimates store Ac
ivregress 2sls voted10 (vfl = regdl) voted10lag if  state=="FL" & (days_06>=-10 & days_06<=9), robust first
estimates store Bc
ivregress 2sls voted10 (vmo = regdl) voted10lag if  state=="MO" & (days_06>=-10 & days_06<=9), robust first
estimates store Cc
*ivregress 2sls voted10 (vca = regdl) voted10lag if  state=="CA" & (days_06>=-10 & days_06<=9), robust first
*estimates store Dc
ivregress 2sls voted10 (vok = regdl) voted10lag if  state=="OK" & (days_06>=-10 & days_06<=9), robust first
estimates store Ec

ivregress 2sls voted08 (var = regdl) voted08lag if  state=="AR" & (days_06>=-10 & days_06<=9), robust first
estimates store Ad
ivregress 2sls voted08 (vco = regdl) voted08lag if  state=="CO" & (days_06>=-10 & days_06<=9), robust first
ivregress 2sls voted08 (vfl = regdl) voted08lag if  state=="FL" & (days_06>=-10 & days_06<=9), robust first
estimates store Bd
ivregress 2sls voted08 (vil = regdl) voted08lag if  state=="IL" & (days_06>=-10 & days_06<=9), robust first
ivregress 2sls voted08 (vmo = regdl) voted08lag if  state=="MO" & (days_06>=-10 & days_06<=9), robust first
estimates store Cd
*ivregress 2sls voted08 (vca = regdl) voted08lag if  state=="CA" & (days_06>=-10 & days_06<=9), robust first
*estimates store Dd
ivregress 2sls voted08 (vok = regdl) voted08lag if  state=="OK" & (days_06>=-10 & days_06<=9), robust first
estimates store Ed

coefplot (Ad \Bd \Cd \Ed), keep(var vca vfl vmo vok) xline(0) ///
coeflabels(vfl="Florida" vok="Oklahoma" var="Arkansas" vca="California" vmo="Missouri", labsize(large)) ///
xtitle("Downstream Non-Voting", size(large)) xlabel(,labsize(large)) ///
xlabel(-.5 (.5) .5,labsize(large)) ///
xscale(range(-.5 .5)) title("2008 Presidential Election", size(vlarge)) grid(none)
graph save "Figure7cong1.gph", replace

coefplot (Ac \Bc \Cc \Ec), keep(var vca vfl vmo vok) xline(0) ///
coeflabels(vfl="Florida" vok="Oklahoma" var="Arkansas" vca="California" vmo="Missouri", labsize(large)) ///
xtitle("Downstream Non-Voting", size(large)) xlabel(,labsize(large)) ///
xlabel(-1.5 (.5) 1.5,labsize(large)) ///
xscale(range(-1.5 1.5)) title("2010 Midterm Elections", size(vlarge)) grid(none)
graph save "Figure7cong2.gph", replace

graph combine Figure7cong1.gph Figure7cong2.gph, ysize(2) altshrink
graph export "Figure7cong.pdf", as(pdf) replace
graph export "Figure7cong.eps", as(eps) replace


* Base rate of voting

* Florida
display (.4757528 - (.1136097*.848537) - ((1-(.0930537-.1136097)-.1136097)*.4308423))/(.0930537-.1136097)
display (.1464607 - (.1136097*.3958692) - ((1-(.0930537-.1136097)-.1136097)*.1265483))/(.0930537-.1136097)

* Oklahoma
display (.1803774 - (.045283*.8333333) - ((1-(.0262113-.045283)-.045283)*.1451876))/(.0262113-.045283)
display (.090566 - (.045283*.4333333) - ((1-(.0262113-.045283)-.045283)*.0717781))/(.0262113-.045283)

* California
display (.268619 - (.0610281*.8277405) - ((1-(.049064-.0610281)-.0610281)*.2392154))/(.049064-.0610281)
display (.1471773 - (.0610281*.5369127) - ((1-(.049064-.0610281)-.0610281)*.1244403))/(.049064-.0610281)




*****************
* APPENDIX A.12 *
*****************

* Figure A.6
use "data.dta", clear

sort state
by state: egen t06 = mean(voted06) if days_06>=-10 & days_06<=-1
by state: egen treatment06 = max(t06)
by state: egen t08 = mean(voted08) if days_08>=-10 & days_08<=-1
by state: egen treatment08 = max(t08)
by state: egen t10 = mean(voted10) if days_10>=-10 & days_10<=-1
by state: egen treatment10 = max(t10)
by state: egen t12 = mean(voted12) if days_12>=-10 & days_12<=-1
by state: egen treatment12 = max(t12)
by state: egen t14 = mean(voted14) if days_14>=-10 & days_14<=-1
by state: egen treatment14 = max(t14)
by state: egen t16 = mean(voted16) if days_16>=-10 & days_16<=-1
by state: egen treatment16 = max(t16)
by state: egen t18 = mean(voted18) if days_18>=-10 & days_18<=-1
by state: egen treatment18 = max(t18)
drop t06 t08 t10 t12 t14 t16 t18

gen regdl = 0
replace regdl = 1 if days_08 >= 0

sort state birthdate
replace voted06lag = voted06lag/treatment06
replace voted08lag = voted08lag/treatment08
replace voted10lag = voted10lag/treatment10
replace voted12lag = voted12lag/treatment12
replace voted14lag = voted14lag/treatment14
replace voted16lag = voted16lag/treatment16
replace voted18lag = voted18lag/treatment18

replace voted06 = voted06/treatment06*100
replace voted08 = voted08/treatment08*100
replace voted10 = voted10/treatment10*100
replace voted12 = voted12/treatment12*100
replace voted14 = voted14/treatment14*100
replace voted16 = voted16/treatment16*100
replace voted18 = voted18/treatment18*100

gen tar = regdl if state=="AR"
gen tco = regdl if state=="CO"
gen tfl = regdl if state=="FL"
gen til = regdl if state=="IL"
gen tky = regdl if state=="KY"
gen tmo = regdl if state=="MO"
gen tmt = regdl if state=="MT"
gen toh = regdl if state=="OH"
gen tpa = regdl if state=="PA"
gen ttx = regdl if state=="TX"
gen tri = regdl if state=="RI"
gen tct = regdl if state=="CT"
gen tia = regdl if state=="IA"
gen tca = regdl if state=="CA"
gen tnj = regdl if state=="NJ"
gen tnv = regdl if state=="NV"
gen tor = regdl if state=="OR"
gen tny = regdl if state=="NY"
gen tok = regdl if state=="OK"

recode tar tco tfl til tky tmo tmt toh tpa ttx tri tct tia tca tnj ///
	tnv tor tny tok (. = 0)

regress voted08 tar voted08lag if (days_08>=-14 & days_08<=13) & state=="AR", robust
estimates store AR
regress voted08 tco voted08lag if (days_08>=-14 & days_08<=13) & state=="CO", robust
estimates store CO
regress voted08 tfl voted08lag if (days_08>=-14 & days_08<=13) & state=="FL", robust
estimates store FL
regress voted08 til voted08lag if (days_08>=-14 & days_08<=13) & state=="IL", robust
estimates store IL
regress voted08 tky voted08lag if (days_08>=-14 & days_08<=13) & state=="KY", robust
estimates store KY
regress voted08 tmo voted08lag if (days_08>=-14 & days_08<=13) & state=="MO", robust
estimates store MO
regress voted08 tmt voted08lag if (days_08>=-14 & days_08<=13) & state=="MT", robust
estimates store MT
regress voted08 toh voted08lag if (days_08>=-14 & days_08<=13) & state=="OH", robust
estimates store OH
*regress voted08 tpa voted08lag if (days_08>=-14 & days_08<=13) & state=="PA", robust
*estimates store PA
regress voted08 ttx voted08lag if (days_08>=-14 & days_08<=13) & state=="TX", robust
estimates store TX
regress voted08 tri voted08lag if (days_08>=-14 & days_08<=13) & state=="RI", robust
estimates store RI
regress voted08 tct voted08lag if (days_08>=-14 & days_08<=13) & state=="CT", robust
estimates store CT
regress voted08 tia voted08lag if (days_08>=-14 & days_08<=13) & state=="IA", robust
estimates store IA
*regress voted08 tca voted08lag if (days_08>=-14 & days_08<=13) & state=="CA", robust
*estimates store CA
regress voted08 tnj voted08lag if (days_08>=-14 & days_08<=13) & state=="NJ", robust
estimates store NJ
regress voted08 tnv voted08lag if (days_08>=-14 & days_08<=13) & state=="NV", robust
estimates store NV
regress voted08 tor voted08lag if (days_08>=-14 & days_08<=13) & state=="OR", robust
estimates store OR
*regress voted08 tny voted08lag if (days_08>=-14 & days_08<=13) & state=="NY", robust
*estimates store NY
regress voted08 tok voted08lag if (days_08>=-14 & days_08<=13) & state=="OK", robust
estimates store OK

set scheme plotplain
coefplot (AR \ CO \ CT \ FL \ IL \ IA \ KY \ MO \ MT \ NV \ NJ \ OH \ OK \ OR \ RI \ TX), ///
	keep(tar tco tfl til tky tmo tmt toh tpa ttx tri tct tia tca tnj ///
	tnv tor tny tok) xline(0) coeflabels(tar="AR" tco="CO" tfl="FL" til="IL" tky="KY" /// 
	tmo="MO" tmt="MT" toh="OH" tpa="PA" ttx="TX" tri="RI" tct="CT" tia="IA" tca="CA" tnj="NJ" /// 
	tnv="NV" tor="OR" tny="NY" tok="OK") xtitle("Estimate Decrease in %", size(medium))   ///
	title("2008 Presidential Election", size(vlarge)) grid(none)
graph save "Figure2_14.gph", replace


drop regdl
gen regdl = 0
replace regdl = 1 if days_12 >= 0
replace tar = regdl if state=="AR"
replace tco = regdl if state=="CO"
replace tfl = regdl if state=="FL"
replace til = regdl if state=="IL"
replace tky = regdl if state=="KY"
replace tmo = regdl if state=="MO"
replace tmt = regdl if state=="MT"
replace toh = regdl if state=="OH"
replace tpa = regdl if state=="PA"
replace ttx = regdl if state=="TX"
replace tri = regdl if state=="RI"
replace tct = regdl if state=="CT"
replace tia = regdl if state=="IA"
replace tca = regdl if state=="CA"
replace tnj = regdl if state=="NJ"
replace tnv = regdl if state=="NV"
replace tor = regdl if state=="OR"
replace tny = regdl if state=="NY"
replace tok = regdl if state=="OK"
recode tar tco tfl til tky tmo tmt toh tpa ttx tri tct tia tca tnj ///
	tnv tor tny tok (. = 0)

estimates clear

regress voted12 tar voted12lag if (days_12>=-14 & days_12<=13) & state=="AR", robust
estimates store AR
regress voted12 tfl voted12lag if (days_12>=-14 & days_12<=13) & state=="FL", robust
estimates store FL
regress voted12 til voted12lag if (days_12>=-14 & days_12<=13) & state=="IL", robust
estimates store IL
regress voted12 tky voted12lag if (days_12>=-14 & days_12<=13) & state=="KY", robust
estimates store KY
regress voted12 tmo voted12lag if (days_12>=-14 & days_12<=13) & state=="MO", robust
estimates store MO
regress voted12 tmt voted12lag if (days_12>=-14 & days_12<=13) & state=="MT", robust
estimates store MT
regress voted12 toh voted12lag if (days_12>=-14 & days_12<=13) & state=="OH", robust
estimates store OH
*regress voted12 tpa voted12lag if (days_12>=-14 & days_12<=13) & state=="PA", robust
*estimates store PA
regress voted12 ttx voted12lag if (days_12>=-14 & days_12<=13) & state=="TX", robust
estimates store TX
regress voted12 tri voted12lag if (days_12>=-14 & days_12<=13) & state=="RI", robust
estimates store RI
regress voted12 tct voted12lag if (days_12>=-14 & days_12<=13) & state=="CT", robust
estimates store CT
*regress voted12 tca voted12lag if (days_12>=-14 & days_12<=13) & state=="CA", robust
*estimates store CA
regress voted12 tnj voted12lag if (days_12>=-14 & days_12<=13) & state=="NJ", robust
estimates store NJ
regress voted12 tnv voted12lag if (days_12>=-14 & days_12<=13) & state=="NV", robust
estimates store NV
regress voted12 tor voted12lag if (days_12>=-14 & days_12<=13) & state=="OR", robust
estimates store OR
*regress voted12 tny voted12lag if (days_12>=-14 & days_12<=13) & state=="NY", robust
*estimates store NY
regress voted12 tok voted12lag if (days_12>=-14 & days_12<=13) & state=="OK", robust
estimates store OK

coefplot (AR \ CT \ FL \ IL \ KY \ MO \ MT \ NV \ NJ \ OH \ OK \ OR \ RI \ TX), ///
	keep(tar tfl til tky tmo tmt toh tpa ttx tri tct tca tnj ///
	tnv tor tny tok) xline(0) coeflabels(tar="AR" tfl="FL" til="IL" tky="KY" /// 
	tmo="MO" tmt="MT" toh="OH" tpa="PA" ttx="TX" tri="RI" tct="CT" tia="IA" tca="CA" tnj="NJ" /// 
	tnv="NV" tor="OR" tny="NY" tok="OK") xtitle("Estimate Decrease in %", size(medium))  ///
	title("2012 Presidential Election", size(vlarge)) grid(none)
graph save "Figure3_14.gph", replace


drop regdl
gen regdl = 0
replace regdl = 1 if days_16 >= 0
replace tar = regdl if state=="AR"
replace tco = regdl if state=="CO"
replace tfl = regdl if state=="FL"
replace til = regdl if state=="IL"
replace tky = regdl if state=="KY"
replace tmo = regdl if state=="MO"
replace tmt = regdl if state=="MT"
replace toh = regdl if state=="OH"
replace tpa = regdl if state=="PA"
replace ttx = regdl if state=="TX"
replace tri = regdl if state=="RI"
replace tct = regdl if state=="CT"
replace tia = regdl if state=="IA"
replace tca = regdl if state=="CA"
replace tnj = regdl if state=="NJ"
replace tnv = regdl if state=="NV"
replace tor = regdl if state=="OR"
replace tny = regdl if state=="NY"
replace tok = regdl if state=="OK"
recode tar tco tfl til tky tmo tmt toh tpa ttx tri tct tia tca tnj ///
	tnv tor tny tok (. = 0)

estimates clear

regress voted16 tfl voted16lag if (days_16>=-14 & days_16<=13) & state=="FL", robust
estimates store FL
regress voted16 toh voted16lag if (days_16>=-14 & days_16<=13) & state=="OH", robust
estimates store OH
*regress voted16 tpa voted16lag if (days_16>=-14 & days_16<=13) & state=="PA", robust
*estimates store PA
* Texas without lagged DV due to missing data
regress voted16 ttx if (days_16>=-14 & days_16<=13) & state=="TX", robust
estimates store TX
*regress voted16 tca voted16lag if (days_16>=-14 & days_16<=13) & state=="CA", robust
*estimates store CA
*regress voted16 tny voted16lag if (days_16>=-14 & days_16<=13) & state=="NY", robust
*estimates store NY
regress voted16 tok voted16lag if (days_16>=-14 & days_16<=13) & state=="OK", robust
estimates store OK

coefplot (FL \ OH \ OK \ TX), ///
	keep(tfl toh tpa ttx tca tny tok) xline(0) coeflabels(tfl="FL" /// 
	toh="OH" tpa="PA" ttx="TX" tca="CA" /// 
	tny="NY" tok="OK") xtitle("Estimate Decrease in %", size(medium))  ///
	xscale(range(-60 40))  xlabel(-60 "-60" -40 "-40" -20 "-20" 0 "0"  ///
	20 "20" 40 "40", angle(horizontal)) xtick(-60(20)40) ///
	title("2016 Presidential Election", size(vlarge)) grid(none)
graph save "Figure3rev_14.gph", replace

graph combine Figure2_14.gph Figure3_14.gph Figure3rev_14.gph, altshrink
graph export "Figure4_14.pdf", as(pdf) replace
graph export "Figure4_14.eps", as(eps) replace



* Figure A.7

drop regdl
gen regdl = 0
replace regdl = 1 if days_08 >= 0
replace tar = regdl if state=="AR"
replace tco = regdl if state=="CO"
replace tfl = regdl if state=="FL"
replace til = regdl if state=="IL"
replace tky = regdl if state=="KY"
replace tmo = regdl if state=="MO"
replace tmt = regdl if state=="MT"
replace toh = regdl if state=="OH"
replace tpa = regdl if state=="PA"
replace ttx = regdl if state=="TX"
replace tri = regdl if state=="RI"
replace tct = regdl if state=="CT"
replace tia = regdl if state=="IA"
replace tca = regdl if state=="CA"
replace tnj = regdl if state=="NJ"
replace tnv = regdl if state=="NV"
replace tor = regdl if state=="OR"
replace tny = regdl if state=="NY"
replace tok = regdl if state=="OK"
recode tar tco tfl til tky tmo tmt toh tpa ttx tri tct tia tca tnj ///
	tnv tor tny tok (. = 0)

estimates clear

regress voted08 tar voted08lag if (days_08>=-7 & days_08<=6) & state=="AR", robust
estimates store AR
regress voted08 tco voted08lag if (days_08>=-7 & days_08<=6) & state=="CO", robust
estimates store CO
regress voted08 tfl voted08lag if (days_08>=-7 & days_08<=6) & state=="FL", robust
estimates store FL
regress voted08 til voted08lag if (days_08>=-7 & days_08<=6) & state=="IL", robust
estimates store IL
regress voted08 tky voted08lag if (days_08>=-7 & days_08<=6) & state=="KY", robust
estimates store KY
regress voted08 tmo voted08lag if (days_08>=-7 & days_08<=6) & state=="MO", robust
estimates store MO
regress voted08 tmt voted08lag if (days_08>=-7 & days_08<=6) & state=="MT", robust
estimates store MT
regress voted08 toh voted08lag if (days_08>=-7 & days_08<=6) & state=="OH", robust
estimates store OH
*regress voted08 tpa voted08lag if (days_08>=-7 & days_08<=6) & state=="PA", robust
*estimates store PA
regress voted08 ttx voted08lag if (days_08>=-7 & days_08<=6) & state=="TX", robust
estimates store TX
regress voted08 tri voted08lag if (days_08>=-7 & days_08<=6) & state=="RI", robust
estimates store RI
regress voted08 tct voted08lag if (days_08>=-7 & days_08<=6) & state=="CT", robust
estimates store CT
regress voted08 tia voted08lag if (days_08>=-7 & days_08<=6) & state=="IA", robust
estimates store IA
*regress voted08 tca voted08lag if (days_08>=-7 & days_08<=6) & state=="CA", robust
*estimates store CA
regress voted08 tnj voted08lag if (days_08>=-7 & days_08<=6) & state=="NJ", robust
estimates store NJ
regress voted08 tnv voted08lag if (days_08>=-7 & days_08<=6) & state=="NV", robust
estimates store NV
regress voted08 tor voted08lag if (days_08>=-7 & days_08<=6) & state=="OR", robust
estimates store OR
*regress voted08 tny voted08lag if (days_08>=-7 & days_08<=6) & state=="NY", robust
*estimates store NY
regress voted08 tok voted08lag if (days_08>=-7 & days_08<=6) & state=="OK", robust
estimates store OK

set scheme plotplain
coefplot (AR \ CO \ CT \ FL \ IL \ IA \ KY \ MO \ MT \ NV \ NJ \ OH \ OK \ OR \ RI \ TX), ///
	keep(tar tco tfl til tky tmo tmt toh tpa ttx tri tct tia tca tnj ///
	tnv tor tny tok) xline(0) coeflabels(tar="AR" tco="CO" tfl="FL" til="IL" tky="KY" /// 
	tmo="MO" tmt="MT" toh="OH" tpa="PA" ttx="TX" tri="RI" tct="CT" tia="IA" tca="CA" tnj="NJ" /// 
	tnv="NV" tor="OR" tny="NY" tok="OK") xtitle("Estimate Decrease in %", size(medium))   ///
	title("2008 Presidential Election", size(vlarge)) grid(none)
graph save "Figure2_7.gph", replace


drop regdl
gen regdl = 0
replace regdl = 1 if days_12 >= 0
replace tar = regdl if state=="AR"
replace tco = regdl if state=="CO"
replace tfl = regdl if state=="FL"
replace til = regdl if state=="IL"
replace tky = regdl if state=="KY"
replace tmo = regdl if state=="MO"
replace tmt = regdl if state=="MT"
replace toh = regdl if state=="OH"
replace tpa = regdl if state=="PA"
replace ttx = regdl if state=="TX"
replace tri = regdl if state=="RI"
replace tct = regdl if state=="CT"
replace tia = regdl if state=="IA"
replace tca = regdl if state=="CA"
replace tnj = regdl if state=="NJ"
replace tnv = regdl if state=="NV"
replace tor = regdl if state=="OR"
replace tny = regdl if state=="NY"
replace tok = regdl if state=="OK"
recode tar tco tfl til tky tmo tmt toh tpa ttx tri tct tia tca tnj ///
	tnv tor tny tok (. = 0)

estimates clear

regress voted12 tar voted12lag if (days_12>=-7 & days_12<=6) & state=="AR", robust
estimates store AR
regress voted12 tfl voted12lag if (days_12>=-7 & days_12<=6) & state=="FL", robust
estimates store FL
regress voted12 til voted12lag if (days_12>=-7 & days_12<=6) & state=="IL", robust
estimates store IL
regress voted12 tky voted12lag if (days_12>=-7 & days_12<=6) & state=="KY", robust
estimates store KY
regress voted12 tmo voted12lag if (days_12>=-7 & days_12<=6) & state=="MO", robust
estimates store MO
regress voted12 tmt voted12lag if (days_12>=-7 & days_12<=6) & state=="MT", robust
estimates store MT
regress voted12 toh voted12lag if (days_12>=-7 & days_12<=6) & state=="OH", robust
estimates store OH
*regress voted12 tpa voted12lag if (days_12>=-7 & days_12<=6) & state=="PA", robust
*estimates store PA
regress voted12 ttx voted12lag if (days_12>=-7 & days_12<=6) & state=="TX", robust
estimates store TX
regress voted12 tri voted12lag if (days_12>=-7 & days_12<=6) & state=="RI", robust
estimates store RI
regress voted12 tct voted12lag if (days_12>=-7 & days_12<=6) & state=="CT", robust
estimates store CT
regress voted12 tia voted12lag if (days_12>=-7 & days_12<=6) & state=="IA", robust
estimates store IA
*regress voted12 tca voted12lag if (days_12>=-7 & days_12<=6) & state=="CA", robust
*estimates store CA
regress voted12 tnj voted12lag if (days_12>=-7 & days_12<=6) & state=="NJ", robust
estimates store NJ
regress voted12 tnv voted12lag if (days_12>=-7 & days_12<=6) & state=="NV", robust
estimates store NV
regress voted12 tor voted12lag if (days_12>=-7 & days_12<=6) & state=="OR", robust
estimates store OR
*regress voted12 tny voted12lag if (days_12>=-7 & days_12<=6) & state=="NY", robust
*estimates store NY
regress voted12 tok voted12lag if (days_12>=-7 & days_12<=6) & state=="OK", robust
estimates store OK

coefplot (AR \ CT \ FL \ IL \ IA \ KY \ MO \ MT \ NV \ NJ \ OH \ OK \ OR \ RI \ TX), ///
	keep(tar tfl til tky tmo tmt toh tpa ttx tri tct tia tca tnj ///
	tnv tor tny tok) xline(0) coeflabels(tar="AR" tfl="FL" til="IL" tky="KY" /// 
	tmo="MO" tmt="MT" toh="OH" tpa="PA" ttx="TX" tri="RI" tct="CT" tia="IA" tca="CA" tnj="NJ" /// 
	tnv="NV" tor="OR" tny="NY" tok="OK") xtitle("Estimate Decrease in %", size(medium))  ///
	title("2012 Presidential Election", size(vlarge)) grid(none)
graph save "Figure3_7.gph", replace


drop regdl
gen regdl = 0
replace regdl = 1 if days_16 >= 0
replace tar = regdl if state=="AR"
replace tco = regdl if state=="CO"
replace tfl = regdl if state=="FL"
replace til = regdl if state=="IL"
replace tky = regdl if state=="KY"
replace tmo = regdl if state=="MO"
replace tmt = regdl if state=="MT"
replace toh = regdl if state=="OH"
replace tpa = regdl if state=="PA"
replace ttx = regdl if state=="TX"
replace tri = regdl if state=="RI"
replace tct = regdl if state=="CT"
replace tia = regdl if state=="IA"
replace tca = regdl if state=="CA"
replace tnj = regdl if state=="NJ"
replace tnv = regdl if state=="NV"
replace tor = regdl if state=="OR"
replace tny = regdl if state=="NY"
replace tok = regdl if state=="OK"
recode tar tco tfl til tky tmo tmt toh tpa ttx tri tct tia tca tnj ///
	tnv tor tny tok (. = 0)

estimates clear

regress voted16 tfl voted16lag if (days_16>=-7 & days_16<=6) & state=="FL", robust
estimates store FL
regress voted16 toh voted16lag if (days_16>=-7 & days_16<=6) & state=="OH", robust
estimates store OH
*regress voted16 tpa voted16lag if (days_16>=-7 & days_16<=6) & state=="PA", robust
*estimates store PA
* Texas without lagged DV due to missing data
regress voted16 ttx if (days_16>=-7 & days_16<=6) & state=="TX", robust
estimates store TX
*regress voted16 tca voted16lag if (days_16>=-7 & days_16<=6) & state=="CA", robust
*estimates store CA
*regress voted16 tny voted16lag if (days_16>=-7 & days_16<=6) & state=="NY", robust
*estimates store NY
regress voted16 tok voted16lag if (days_16>=-7 & days_16<=6) & state=="OK", robust
estimates store OK

coefplot (FL \ OH \ OK \ TX), ///
	keep(tfl toh tpa ttx tca tny tok) xline(0) coeflabels(tfl="FL" /// 
	toh="OH" tpa="PA" ttx="TX" tca="CA" /// 
	tny="NY" tok="OK") xtitle("Estimate Decrease in %", size(medium))  ///
	xscale(range(-60 40))  xlabel(-60 "-60" -40 "-40" -20 "-20" 0 "0"  ///
	20 "20" 40 "40", angle(horizontal)) xtick(-60(20)40) ///
	title("2016 Presidential Election", size(vlarge)) grid(none)
graph save "Figure3rev_7.gph", replace

graph combine Figure2_7.gph Figure3_7.gph Figure3rev_7.gph, altshrink
graph export "Figure4_7.pdf", as(pdf) replace
graph export "Figure4_7.eps", as(eps) replace



* Figure A.8
use "data.dta", clear

encode state, gen(state2)
tab state2, gen(sdum)

gen regdl = 0
replace regdl = 1 if days_08 >= 0

gen var = voted08 * sdum1
gen vco = voted08 * sdum2
gen vfl = voted08 * sdum4
gen vil = voted08 * sdum6
gen vky = voted08 * sdum7
gen vmo = voted08 * sdum8
gen vmt = voted08 * sdum9
gen voh = voted08 * sdum12
gen vtx = voted08 * sdum16
gen vri = voted08 * sdum15
gen vct = voted08 * sdum3
gen via = voted08 * sdum5
gen vnj = voted08 * sdum10
gen vnv = voted08 * sdum11
gen vor = voted08 * sdum14
gen vok = voted08 * sdum13

ivregress 2sls voted12 (var = regdl) voted12lag if  state=="AR" & (days_08>=-7 & days_08<=6), robust first
estimates store A
ivregress 2sls voted12 (vfl = regdl) voted12lag if  state=="FL" & (days_08>=-7 & days_08<=6), robust first
estimates store B
ivregress 2sls voted12 (vil = regdl) voted12lag if  state=="IL" & (days_08>=-7 & days_08<=6), robust first
estimates store C
ivregress 2sls voted12 (vmo = regdl) voted12lag if  state=="MO" & (days_08>=-7 & days_08<=6), robust first
estimates store D
*ivregress 2sls voted12 (vpa = regdl) voted12lag if  state=="PA" & (days_08>=-7 & days_08<=6), robust first
*estimates store E
ivregress 2sls voted12 (vtx = regdl) voted12lag if  state=="TX" & (days_08>=-7 & days_08<=6), robust first
estimates store F
ivregress 2sls voted12 (vri = regdl) voted12lag if  state=="RI" & (days_08>=-7 & days_08<=6), robust first
estimates store I
ivregress 2sls voted12 (vok = regdl) voted12lag if  state=="OK" & (days_08>=-7 & days_08<=6), robust first
estimates store G

set scheme plotplain
coefplot (A \B \C \D \G \I \F), keep(var vfl vil vmo vok vpa vri vtx) ///
xline(0) coeflabels(var="Arkansas" vfl="Florida" vil="Illinois" vmo="Missouri" vok="Oklahoma" vpa="Pennsylvania" vtx="Texas" vri="Rhode Island", labsize(large)) ///
xtitle("Downstream Non-Voting", size(large)) xlabel(,labsize(large)) ///
title("2012 Presidential Election", size(vlarge)) grid(none)
graph save "Figure5_7.gph", replace

ivregress 2sls voted16 (vfl = regdl) voted16lag if  state=="FL" & (days_08>=-7 & days_08<=6), robust first
estimates store J
*ivregress 2sls voted16 (vpa = regdl) voted16lag if  state=="PA" & (days_08>=-7 & days_08<=6), robust first
*estimates store K
ivregress 2sls voted16 (vok = regdl) voted16lag if  state=="OK" & (days_08>=-7 & days_08<=6), robust first
estimates store M

coefplot (J \M), keep(vfl vok vpa) xline(0) ///
coeflabels(vfl="Florida" vok="Oklahoma" vpa="Pennsylvania", labsize(large)) ///
xtitle("Downstream Non-Voting", size(large)) xlabel(,labsize(large)) ///
title("2016 Presidential Election", size(vlarge)) grid(none)
*groups(v08fl v08tx v08il="Large Drop" v08*="Small Drop", labsize(large))
graph save "Figure6_7.gph", replace

graph combine Figure5_7.gph Figure6_7.gph, ysize(2) altshrink
graph export "Figure7_7.pdf", as(pdf) replace
graph export "Figure7_7.eps", as(eps) replace




******************
* APPENDIX A. 13 *
******************

* Figure A.9
use "data.dta", clear

sort state
by state: egen t06 = mean(voted06) if days_06>=-10 & days_06<=-1
by state: egen treatment06 = max(t06)
by state: egen t08 = mean(voted08) if days_08>=-10 & days_08<=-1
by state: egen treatment08 = max(t08)
by state: egen t10 = mean(voted10) if days_10>=-10 & days_10<=-1
by state: egen treatment10 = max(t10)
by state: egen t12 = mean(voted12) if days_12>=-10 & days_12<=-1
by state: egen treatment12 = max(t12)
by state: egen t14 = mean(voted14) if days_14>=-10 & days_14<=-1
by state: egen treatment14 = max(t14)
by state: egen t16 = mean(voted16) if days_16>=-10 & days_16<=-1
by state: egen treatment16 = max(t16)
by state: egen t18 = mean(voted18) if days_18>=-10 & days_18<=-1
by state: egen treatment18 = max(t18)
drop t06 t08 t10 t12 t14 t16 t18

gen regdl = 0
replace regdl = 1 if days_08 >= 0

sort state birthdate
replace voted06lag = voted06lag/treatment06
replace voted08lag = voted08lag/treatment08
replace voted10lag = voted10lag/treatment10
replace voted12lag = voted12lag/treatment12
replace voted14lag = voted14lag/treatment14
replace voted16lag = voted16lag/treatment16
replace voted18lag = voted18lag/treatment18

replace voted06 = voted06/treatment06*100
replace voted08 = voted08/treatment08*100
replace voted10 = voted10/treatment10*100
replace voted12 = voted12/treatment12*100
replace voted14 = voted14/treatment14*100
replace voted16 = voted16/treatment16*100
replace voted18 = voted18/treatment18*100

gen tar = regdl if state=="AR"
gen tco = regdl if state=="CO"
gen tfl = regdl if state=="FL"
gen til = regdl if state=="IL"
gen tky = regdl if state=="KY"
gen tmo = regdl if state=="MO"
gen tmt = regdl if state=="MT"
gen toh = regdl if state=="OH"
gen tpa = regdl if state=="PA"
gen ttx = regdl if state=="TX"
gen tri = regdl if state=="RI"
gen tct = regdl if state=="CT"
gen tia = regdl if state=="IA"
gen tca = regdl if state=="CA"
gen tnj = regdl if state=="NJ"
gen tnv = regdl if state=="NV"
gen tor = regdl if state=="OR"
gen tny = regdl if state=="NY"
gen tok = regdl if state=="OK"

recode tar tco tfl til tky tmo tmt toh tpa ttx tri tct tia tca tnj ///
	tnv tor tny tok (. = 0)

regress voted08 tar  if (days_08>=-7 & days_08<=6) & state=="AR", robust
estimates store AR
regress voted08 tco  if (days_08>=-7 & days_08<=6) & state=="CO", robust
estimates store CO
regress voted08 tfl  if (days_08>=-7 & days_08<=6) & state=="FL", robust
estimates store FL
regress voted08 til  if (days_08>=-7 & days_08<=6) & state=="IL", robust
estimates store IL
regress voted08 tky  if (days_08>=-7 & days_08<=6) & state=="KY", robust
estimates store KY
regress voted08 tmo  if (days_08>=-7 & days_08<=6) & state=="MO", robust
estimates store MO
regress voted08 tmt  if (days_08>=-7 & days_08<=6) & state=="MT", robust
estimates store MT
regress voted08 toh  if (days_08>=-7 & days_08<=6) & state=="OH", robust
estimates store OH
*regress voted08 tpa  if (days_08>=-7 & days_08<=6) & state=="PA", robust
*estimates store PA
regress voted08 ttx  if (days_08>=-7 & days_08<=6) & state=="TX", robust
estimates store TX
regress voted08 tri  if (days_08>=-7 & days_08<=6) & state=="RI", robust
estimates store RI
regress voted08 tct  if (days_08>=-7 & days_08<=6) & state=="CT", robust
estimates store CT
regress voted08 tia  if (days_08>=-7 & days_08<=6) & state=="IA", robust
estimates store IA
*regress voted08 tca  if (days_08>=-7 & days_08<=6) & state=="CA", robust
*estimates store CA
regress voted08 tnj  if (days_08>=-7 & days_08<=6) & state=="NJ", robust
estimates store NJ
regress voted08 tnv  if (days_08>=-7 & days_08<=6) & state=="NV", robust
estimates store NV
regress voted08 tor  if (days_08>=-7 & days_08<=6) & state=="OR", robust
estimates store OR
*regress voted08 tny  if (days_08>=-7 & days_08<=6) & state=="NY", robust
*estimates store NY
regress voted08 tok  if (days_08>=-7 & days_08<=6) & state=="OK", robust
estimates store OK

set scheme plotplain
coefplot (AR \ CO \ CT \ FL \ IL \ IA \ KY \ MO \ MT \ NV \ NJ \ OH \ OK \ OR \ RI \ TX), ///
	keep(tar tco tfl til tky tmo tmt toh tpa ttx tri tct tia tca tnj ///
	tnv tor tny tok) xline(0) coeflabels(tar="AR" tco="CO" tfl="FL" til="IL" tky="KY" /// 
	tmo="MO" tmt="MT" toh="OH" tpa="PA" ttx="TX" tri="RI" tct="CT" tia="IA" tca="CA" tnj="NJ" /// 
	tnv="NV" tor="OR" tny="NY" tok="OK") xtitle("Estimate Decrease in %", size(medium))   ///
	title("2008 Presidential Election", size(vlarge)) grid(none)
graph save "Figure2_nolag.gph", replace


drop regdl
gen regdl = 0
replace regdl = 1 if days_12 >= 0
replace tar = regdl if state=="AR"
replace tco = regdl if state=="CO"
replace tfl = regdl if state=="FL"
replace til = regdl if state=="IL"
replace tky = regdl if state=="KY"
replace tmo = regdl if state=="MO"
replace tmt = regdl if state=="MT"
replace toh = regdl if state=="OH"
replace tpa = regdl if state=="PA"
replace ttx = regdl if state=="TX"
replace tri = regdl if state=="RI"
replace tct = regdl if state=="CT"
replace tia = regdl if state=="IA"
replace tca = regdl if state=="CA"
replace tnj = regdl if state=="NJ"
replace tnv = regdl if state=="NV"
replace tor = regdl if state=="OR"
replace tny = regdl if state=="NY"
replace tok = regdl if state=="OK"
recode tar tco tfl til tky tmo tmt toh tpa ttx tri tct tia tca tnj ///
	tnv tor tny tok (. = 0)

estimates clear

regress voted12 tar  if (days_12>=-7 & days_12<=6) & state=="AR", robust
estimates store AR
regress voted12 tfl  if (days_12>=-7 & days_12<=6) & state=="FL", robust
estimates store FL
regress voted12 til  if (days_12>=-7 & days_12<=6) & state=="IL", robust
estimates store IL
regress voted12 tky  if (days_12>=-7 & days_12<=6) & state=="KY", robust
estimates store KY
regress voted12 tmo  if (days_12>=-7 & days_12<=6) & state=="MO", robust
estimates store MO
regress voted12 tmt  if (days_12>=-7 & days_12<=6) & state=="MT", robust
estimates store MT
regress voted12 toh  if (days_12>=-7 & days_12<=6) & state=="OH", robust
estimates store OH
*regress voted12 tpa  if (days_12>=-7 & days_12<=6) & state=="PA", robust
*estimates store PA
regress voted12 ttx  if (days_12>=-7 & days_12<=6) & state=="TX", robust
estimates store TX
regress voted12 tri  if (days_12>=-7 & days_12<=6) & state=="RI", robust
estimates store RI
regress voted12 tct  if (days_12>=-7 & days_12<=6) & state=="CT", robust
estimates store CT
regress voted12 tia  if (days_12>=-7 & days_12<=6) & state=="IA", robust
estimates store IA
*regress voted12 tca  if (days_12>=-7 & days_12<=6) & state=="CA", robust
*estimates store CA
regress voted12 tnj  if (days_12>=-7 & days_12<=6) & state=="NJ", robust
estimates store NJ
regress voted12 tnv  if (days_12>=-7 & days_12<=6) & state=="NV", robust
estimates store NV
regress voted12 tor  if (days_12>=-7 & days_12<=6) & state=="OR", robust
estimates store OR
*regress voted12 tny  if (days_12>=-7 & days_12<=6) & state=="NY", robust
*estimates store NY
regress voted12 tok  if (days_12>=-7 & days_12<=6) & state=="OK", robust
estimates store OK

coefplot (AR \ CT \ FL \ IL \ IA \ KY \ MO \ MT \ NV \ NJ \ OH \ OK \ OR \ RI \ TX), ///
	keep(tar tfl til tky tmo tmt toh tpa ttx tri tct tia tca tnj ///
	tnv tor tny tok) xline(0) coeflabels(tar="AR" tfl="FL" til="IL" tky="KY" /// 
	tmo="MO" tmt="MT" toh="OH" tpa="PA" ttx="TX" tri="RI" tct="CT" tia="IA" tca="CA" tnj="NJ" /// 
	tnv="NV" tor="OR" tny="NY" tok="OK") xtitle("Estimate Decrease in %", size(medium))  ///
	title("2012 Presidential Election", size(vlarge)) grid(none)
graph save "Figure3_nolag.gph", replace


drop regdl
gen regdl = 0
replace regdl = 1 if days_16 >= 0
replace tar = regdl if state=="AR"
replace tco = regdl if state=="CO"
replace tfl = regdl if state=="FL"
replace til = regdl if state=="IL"
replace tky = regdl if state=="KY"
replace tmo = regdl if state=="MO"
replace tmt = regdl if state=="MT"
replace toh = regdl if state=="OH"
replace tpa = regdl if state=="PA"
replace ttx = regdl if state=="TX"
replace tri = regdl if state=="RI"
replace tct = regdl if state=="CT"
replace tia = regdl if state=="IA"
replace tca = regdl if state=="CA"
replace tnj = regdl if state=="NJ"
replace tnv = regdl if state=="NV"
replace tor = regdl if state=="OR"
replace tny = regdl if state=="NY"
replace tok = regdl if state=="OK"
recode tar tco tfl til tky tmo tmt toh tpa ttx tri tct tia tca tnj ///
	tnv tor tny tok (. = 0)

estimates clear

regress voted16 tfl if (days_16>=-7 & days_16<=6) & state=="FL", robust
estimates store FL
regress voted16 toh if (days_16>=-7 & days_16<=6) & state=="OH", robust
estimates store OH
*regress voted16 tpa if (days_16>=-7 & days_16<=6) & state=="PA", robust
*estimates store PA
* Texas without lagged DV due to missing data
regress voted16 ttx if (days_16>=-7 & days_16<=6) & state=="TX", robust
estimates store TX
*regress voted16 tca if (days_16>=-7 & days_16<=6) & state=="CA", robust
*estimates store CA
*regress voted16 tny if (days_16>=-7 & days_16<=6) & state=="NY", robust
*estimates store NY
regress voted16 tok if (days_16>=-7 & days_16<=6) & state=="OK", robust
estimates store OK

coefplot (FL \ OH \ OK \ TX), ///
	keep(tfl toh tpa ttx tca tny tok) xline(0) coeflabels(tfl="FL" /// 
	toh="OH" tpa="PA" ttx="TX" tca="CA" /// 
	tny="NY" tok="OK") xtitle("Estimate Decrease in %", size(medium))  ///
	xscale(range(-60 40))  xlabel(-60 "-60" -40 "-40" -20 "-20" 0 "0"  ///
	20 "20" 40 "40", angle(horizontal)) xtick(-60(20)40) ///
	title("2016 Presidential Election", size(vlarge)) grid(none)
graph save "Figure3rev_nolag.gph", replace

graph combine Figure2_nolag.gph Figure3_nolag.gph Figure3rev_nolag.gph, altshrink
graph export "Figure4_nolag.pdf", as(pdf) replace
graph export "Figure4_nolag.eps", as(eps) replace


* Figure A.10
use "data.dta", clear

encode state, gen(state2)
tab state2, gen(sdum)

gen regdl = 0
replace regdl = 1 if days_08 >= 0

gen var = voted08 * sdum1
gen vco = voted08 * sdum2
gen vfl = voted08 * sdum4
gen vil = voted08 * sdum6
gen vky = voted08 * sdum7
gen vmo = voted08 * sdum8
gen vmt = voted08 * sdum9
gen voh = voted08 * sdum12
gen vtx = voted08 * sdum16
gen vri = voted08 * sdum15
gen vct = voted08 * sdum3
gen via = voted08 * sdum5
gen vnj = voted08 * sdum10
gen vnv = voted08 * sdum11
gen vor = voted08 * sdum14
gen vok = voted08 * sdum13

ivregress 2sls voted12 (var = regdl)  if  state=="AR" & (days_08>=-7 & days_08<=6), robust first
estimates store A
ivregress 2sls voted12 (vfl = regdl)  if  state=="FL" & (days_08>=-7 & days_08<=6), robust first
estimates store B
ivregress 2sls voted12 (vil = regdl)  if  state=="IL" & (days_08>=-7 & days_08<=6), robust first
estimates store C
ivregress 2sls voted12 (vmo = regdl)  if  state=="MO" & (days_08>=-7 & days_08<=6), robust first
estimates store D
*ivregress 2sls voted12 (vpa = regdl)  if  state=="PA" & (days_08>=-7 & days_08<=6), robust first
*estimates store E
ivregress 2sls voted12 (vtx = regdl)  if  state=="TX" & (days_08>=-7 & days_08<=6), robust first
estimates store F
ivregress 2sls voted12 (vri = regdl)  if  state=="RI" & (days_08>=-7 & days_08<=6), robust first
estimates store I
ivregress 2sls voted12 (vok = regdl)  if  state=="OK" & (days_08>=-7 & days_08<=6), robust first
estimates store G

set scheme plotplain
coefplot (A \B \C \D \G \I \F), keep(var vfl vil vmo vok vpa vri vtx) ///
xline(0) coeflabels(var="Arkansas" vfl="Florida" vil="Illinois" vmo="Missouri" vok="Oklahoma" vpa="Pennsylvania" vtx="Texas" vri="Rhode Island", labsize(large)) ///
xtitle("Downstream Non-Voting", size(large)) xlabel(,labsize(large)) ///
title("2012 Presidential Election", size(vlarge)) grid(none)
graph save "Figure5_nolag.gph", replace

ivregress 2sls voted16 (vfl = regdl)  if  state=="FL" & (days_08>=-7 & days_08<=6), robust first
estimates store J
*ivregress 2sls voted16 (vpa = regdl)  if  state=="PA" & (days_08>=-7 & days_08<=6), robust first
*estimates store K
ivregress 2sls voted16 (vtx = regdl) if  state=="TX" & (days_08>=-7 & days_08<=6), robust first
estimates store L
ivregress 2sls voted16 (vok = regdl)  if  state=="OK" & (days_08>=-7 & days_08<=6), robust first
estimates store M

coefplot (J \M \L), keep(vfl vok vpa vtx) xline(0) ///
coeflabels(vfl="Florida" vok="Oklahoma" vpa="Pennsylvania" vtx="Texas", labsize(large)) ///
xtitle("Downstream Non-Voting", size(large)) xlabel(,labsize(large)) ///
title("2016 Presidential Election", size(vlarge)) grid(none)
graph save "Figure6_nolag.gph", replace

graph combine Figure5_nolag.gph Figure6_nolag.gph, ysize(2) altshrink
graph export "Figure7_nolag.pdf", as(pdf) replace
graph export "Figure7_nolag.eps", as(eps) replace




*****************
* APPENDIX A.14 *
*****************

use "data.dta", clear

gen regdl = 0
replace regdl = 1 if days_08 >= 0

replace turnout08=voted08/birth_res*100

gen tfl = regdl if state=="FL"
gen til = regdl if state=="IL"
gen toh = regdl if state=="OH"
gen tpa = regdl if state=="PA"
gen ttx = regdl if state=="TX"
gen tny = regdl if state=="NY"

recode tfl til toh tpa ttx tny (. = 0)

regress turnout08 tfl  if (days_08>=-10 & days_08<=9) & state=="FL", robust
estimates store FL
regress turnout08 til  if (days_08>=-10 & days_08<=9) & state=="IL", robust
estimates store IL
regress turnout08 toh  if (days_08>=-10 & days_08<=9) & state=="OH", robust
estimates store OH
*regress turnout08 tpa  if (days_08>=-10 & days_08<=9) & state=="PA", robust
*estimates store PA
regress turnout08 ttx  if (days_08>=-10 & days_08<=9) & state=="TX", robust
estimates store TX
*regress turnout08 tny  if (days_08>=-10 & days_08<=9) & state=="NY", robust
*estimates store NY

set scheme plotplain
coefplot (FL \ IL  \ OH \ TX), ///
	keep(tfl til toh tpa ttx  ///
	tny regdl) xline(0)  coeflabels(tfl="Florida" til="Illinois" tny="New York" /// 
	toh="Ohio" tpa="Pennsylvania" ttx="Texas", labsize(large)) xtitle("Change in Turnout", size(large)) ///
	xlabel(,labsize(large)) title("10-Day Window", size(vlarge)) grid(none)
graph save "Figure2_t10.gph", replace

estimates clear

regress turnout08 tfl  if (days_08>=-7 & days_08<=6) & state=="FL", robust
estimates store FL
regress turnout08 til  if (days_08>=-7 & days_08<=6) & state=="IL", robust
estimates store IL
regress turnout08 toh  if (days_08>=-7 & days_08<=6) & state=="OH", robust
estimates store OH
*regress turnout08 tpa  if (days_08>=-7 & days_08<=6) & state=="PA", robust
*estimates store PA
regress turnout08 ttx  if (days_08>=-7 & days_08<=6) & state=="TX", robust
estimates store TX
*regress turnout08 tny  if (days_08>=-7 & days_08<=6) & state=="NY", robust
*estimates store NY

set scheme plotplain
coefplot (FL \ IL  \ OH \ TX), ///
	keep(tfl til toh tpa ttx  ///
	tny) xline(0)  coeflabels(tfl="Florida" til="Illinois" tny="New York" /// 
	toh="Ohio" tpa="Pennsylvania" ttx="Texas", labsize(large)) xtitle("Change in Turnout", size(large)) ///
	xlabel(,labsize(large)) title("7-Day Window", size(vlarge)) grid(none)
graph save "Figure2_t7.gph", replace

graph combine Figure2_t10.gph Figure2_t7.gph, ysize(2) altshrink
graph export "Figure4_t10_t7.pdf", as(pdf) replace
graph export "Figure4_t10_t7.eps", as(eps) replace


* The following regression is used to estimate the voter turnout among pre-registration deadline eligibles in 2008 in states with an early registration deadline and no SDR that is reported in the results section of the article.

replace turnout08=voted08/birthre_l*100

*regress turnout08 regdl if (days_08>=-10 & days_08<=9) & (state=="AR" | state=="CO" | state=="FL" | state=="IL" | state=="KY" | state=="MO" | state=="NY" | state=="OH" | state=="OK" | state=="PA" | state=="RI" | state=="TX"), vce(cluster state)




*****************
* APPENDIX A.15 *
*****************

use "data.dta", clear

set scheme plotplain
replace rv08=-rv08
twoway (scatter birth_res rv08, mcolor(gs10)) (lpolyci birth_res rv08 if rv08>=-1 & rv08<-.1521, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) ///
	(lpolyci birth_res rv08 if rv08>=-.1521 & rv08<=0, lp(solid) lcolor(black) ciplot(rline) alpattern(shortdash)) ///
	(lpolyci birth_res rv08 if rv08>0 & rv08<=1, lcolor(black) ciplot(rline)) ///
	if state=="FL" & rv08>-1 & rv08<1, ytitle(Number of births, size(small)) ///
	xtitle(Date of Birth, size(small)) xlabel(, nogrid) ///
	xline(-.1521739, lc(black)) xline(0, lc(black)) xtitle(, margin(top)) xlabel(-1 "5/4/90" -.5 "8/4/90" 0 "11/4/90" .5 ///
	"2/4/91" 1 "5/4/91", labsize(small) valuelabel) title("Births in Florida, 1990-1991", bexpand justification(left) size(medium)) legend(off)

graph export "FLbirths.pdf", as(pdf) replace
graph export "FLbirths.eps", as(eps) replace




*****************
* APPENDIX A.16 *
*****************

* Trinity College Dublin's data protection policy does not allow the author to share the data that was used for the subgroup analyses by race and gender in Appendix A.16.




*****************
* APPENDIX A.17 *
*****************

use "data_reg.dta", clear

twoway (line reg ageatreg, lcolor(black) lpattern(solid)), ///
	xlabel(, nogrid) ///
	ytitle(Average Number of People Registering, size(mlarge)) xtitle(Age at Registration, size(mlarge)) ///
	xtitle(, margin(top)) xlabel(6565 "-10 days" 6575 "18th Birthday" 6584 "+9 days", labsize(mlarge) valuelabel) ///
	ylabel(0(1)7) yscale(range(0 7)) legend(off)
graph export "FigureAAR+.pdf", as(pdf) replace
graph export "FigureAAR+.eps", as(eps) replace

